I than you for your suggestion.
I have a question for you: I would like to utilize Keyboard Maestro so I can create a macro where I’d be able to trigger DTP to open up together with particular files within its database. I now that this would be easy to accomplish if the files are not stored in DTP…
If you want to open a particular document (or a particular group that contains several documents), start by control-clicking the document or group and choosing the Copy Item Link command. Nothing obvious will happen, but a link like this will be placed on your clipboard
You can paste that link wherever links are clickable – including in a KM macro. When clicked, DEVONthink will open (including starting up if not currently running) and that document or that group will open. The link is unique – no other document or group will have the same digits after the “x-devonthink-item” portion. You’ll need to grab the specific link for each document or group you want to open up.
Thank you for your prompt reply! It’s good to know that “copy item link” works.
Although not that important, I wish I can open a file within my DTP database with an app other than DTP such as Microsoft Word, SKIM etc…
P.S. I was able to open my file using “open url”; “open file” did not work in this case.
You can use the link in many programs – but Microsoft Office isn’t usually one of them. The link is an URL – it is not a file.
Easy enough to do with a little planning. Here are a couple of examples-the first opens the document in the default application for the document linked in the x-devonthink-item url (Preview for a PDF in this example). The second opens the document linked in the x-devonthink-item url in a specific application. Both macros contain steps to close the document window in DEVONthink and switch back to the specified app that has the document open. The macros contain a pause step that may or may not be necessary-I usually include a pause in macros that bounce between apps as they are sometimes needed to keep things from breaking.
You could create one or both of these macros and use them as templates (duplicate the original) and quickly edit them with different x-devonthink-item urls and applications as needed. You could also duplicate steps within the macro to open multiple documents with one macro.
Open a DEVONthink url to a PDF document in the default app, Preview:
Open a DEVONthink url to a PDF document in a specific app, such as PDFpenPro:
Thanks! I can find my way around KM fairly well-I just wish I was half as talented using AppleScript as you are.
tell application id "DNtp" repeat with thisRecord in (selection as list) if (type of thisRecord) = PDF document then tell application "PDFpen" activate open ((get path of thisRecord) as POSIX file) end tell end if end repeat end tell
A little core if it’s of use to anyone.
Hi Korm I was wondering how the applescript worked with KM I can’t seem to workout the keyboard maestro macro elements that will get the script to work with a finder selection.
Also does it need to be an imported file or does the script work with indexed files as well?
that’s great i was 3/4 of the way there but had missed one of the variable settings.
Thanks so much for your legendary help!
One suggestion to make to this script, or any other script that calls the DEVONthink application id, to make it compatible with future versions of DEVONthink:
tell application id "com.devon-technologies.thinkpro2"
tell application id "DNtp"
The script is out of date and will be reposted when time permits.