Anyway, here’s what I’ve got. It doesn’t work, but maybe you can offer some pointers? What I’d like to do is have the workflow open DevonThink, select the specified database, and search it with the search query. I don’t need to open the special search window (although it might be neat to see how to do that). If you could point me to existing scripts, I’m happy to tinker with them as well.
on run
set theQuery to "{query}"
tell application id "DNtp"
set theDatabase to open database "~/Documents/Notes.dtBase2"
search theQuery in theDatabase
end tell
end run
At some point I will be able to devote the time and resources to learning AppleScript and /or Javascript Mac automation, but other projects are a priority now, thus my request for help.
If there are a few AppleScript techniques / concepts that would help me accomplish my task, I’d appreciate being pointed in the right direction.
In your AppleScript editor (e.g., Script Editor or Script Debugger) you might want to confirm command syntax by browsing the DEVONthink scripting dictionary.
For example
search theQuery in theDatabase
is not correct syntax – and the script will fail silently. This is correct:
set theResult to search theQuery in theDatabase
The problem with this is that the commands do not cause the DEVONthink interface to open and display anything. They merely put data into a variable, and you need to do something with the variable. Have you script display it in a window, or something.
BTW – the Alfred workflow mentioned in the OP works fine over here in Alfred 3.4 [850]. There are several commands in the workflow, as discussed in the source. It is necessary to “prime” the workflow by declaring the database to search. Anyway – that’s off topic for this forum.