This is my first try to using a AppleScript and DevonThink
I am trying to open DV, then move the cursor to the search field, paste the clipboard. It all seems to work except the paste to clipboard. Or maybe timing not waiting for DVt get fully open?
tell application "DevonThink 3" to activate
tell application "System Events"
key code 48
keystroke "v" using command down
end tell
I don’t know about that, and generally UI scripting can be a bit finicky. But if you only want to paste the clipboard, why not simply use the clipboard from Standard Additions?
Also, if you’re posting code here, it would be helpful to include it in three backticks like so
``` code goes here
```
so that other people can easily copy/paste it and open it in Script Editor. I changed that in your original post.
-- Search clipboard in new window
tell application id "DNtp"
try
set theWindow to open window for record incoming group with force
set search query of theWindow to the clipboard
activate
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
return
end try
end tell
I learned by looking at some of the example scripts included with DEVONthink and also reading a lot of scripts posted here (by using the forum search function to find what I needed). There are also some useful general resources on the Net to get you started, of course.
It’s really not too much of a challenge to do some basic stuff with AppleScript: if I can do it, anyone can!
When you find useful snippets of code it helps to store them in DEVONthink, of course. I often refer back to them and use or adapt them.
People on this forum are also amazingly helpful if you ever get stuck—however many times you have to ask for help!