I’m trying to use Keyboard Maestroboard Maestro to trigger a smart rule in DEVONthink when I connect to a specific network. Note that the performSmartRule piece works when running it in DEVONthink. But I’m having trouble when trying to trigger it with Keyboard Maestro. Here’s the script I’m using:
tell application id "DNtp"
set theRule to get rule with name "Move to Network"
if theRule is not missing value then
set theRecords to every record whose (kind ≠ "Group") and (kind ≠ "Database") and (kind ≠ "Trash") of (root of theRule)
display dialog "Found Smart Rule and records"
set theResult to performSmartRule(theRecords)
else
display dialog "Smart Rule not found"
end if
end tell
on performSmartRule(theRecords)
tell application id "DNtp"
set movedFiles to {}
set theNetworkFolder to get record with uuid "08CF2152-0D61-4E6E-A7D7-DD41AC540011"
repeat with theRecord in theRecords
set thePath to path of theRecord
if thePath is not missing value then
move record theRecord to theNetworkFolder
set end of movedFiles to thePath
end if
end repeat
if movedFiles is not {} then
display dialog "Moved files to " & (name of theNetworkFolder) & return & (movedFiles as text)
else
display dialog "No files found to move"
end if
return movedFiles
end tell
end performSmartRule
However, I’m encountering an error (see below) when I try to run the script. I’ve tried making some modifications to the script, but I haven’t been able to get it to work. Can anyone provide some advice on how to modify the script to get it to work?
FYI, I’m using Keyboard Maestro to trigger the script because it offers the "wireless network trigger” feature. The ultimate goal is that I want the script to run in DEVONthink as soon as I am connected to my office network.
Thanks in advance for your help!