As shown in the figure, after entering the link in Alfred, is there a way to open it directly with PDF expert? Instead of opening in DT and then choose to open in PDF Expert.
Thank you very much for your answer
As shown in the figure, after entering the link in Alfred, is there a way to open it directly with PDF expert? Instead of opening in DT and then choose to open in PDF Expert.
Thank you very much for your answer
No, thereās not. Thatās not how URL schemes work.
The URL scheme belongs to DEVONthink and only activates it.
I donāt run Alfred, but it would likely be possible to create a Powerpack workflow get record with uuid
, get the path of the item, and pass that to PDF Expert to open.
I will try it. Thanks for your advice.
Youāre welcome
This script uses the default app to open the record
-- Open record with default app
set theReferenceURL to "x-devonthink-item://4D3C5C22-DF6C-4264-A279-A0B7386A2822" -- replace this with e.g. Alfred's input
tell application id "DNtp"
try
set theRecord to (get record with uuid theReferenceURL)
if theRecord = missing value then error "No record"
set thePath to path of theRecord
if thePath = "" or (POSIX file thePath as string) ends with ":" then error "No file"
tell application "Finder"
open file (POSIX file thePath as alias)
end tell
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
Oh! Thank you so much for your reply! But I donāt know anything about how to use computer scripts. If you have time, can you give me an overview of how the script should be used?
Thanks again!
Perhaps you can provide very effective guidance, if you wish? @BLUEFROG
Maybe googling āAlfred AppleScriptā helps? Or they provide online explanations on how to incorporate scripts in their workflows.
As I said, I donāt run Alfred.
From what I gather, you need the Powerpack purchase to create a workflow. I believe the workflows have a node for running AppleScripts.
Okay, got it. Very lucky to have met you. Have a nice day.
Hereās how a blank Workflow is created in Alfred:
Workflows
tab at the upper left corner+
at the bottom and Blank Workflow
Hereās how an AppleScript action is created:
In Alfredās script editor window:
Language
dropdown and select /usr/bin/osascript (AS)
with input as {query}
Your Run Script
action should look like this:
"{query}"
is the input that the script gets from Alfred.
How you like to input a DEVONthink Reference URL into Alfred is up to you (at the moment I canāt imagine a way that would make sense).
Visit the Alfred forum for Alfred questions.
Thank you for your patience and detailed guidance!
I followed your steps to create the exact same workflow, but I still canāt get it to work. Do I need to create other steps in that workflow?
If you have a ready-made workflow that can be implemented, can you forward it to share? Thanks again!
Of course. The script needs some input:
But thatās not related to DEVONthink. Did you ask in the Alfred Forum?
See, for example, this post on the Alfred forums, and the linked workflow (which I use from time to time).
Stephen
Out of curiosity: Could you also write
if the Path = "" or thePath ends with "/"
since ā/ā in Unix is equivalent to ā:ā in HPFSā¦?
Is this check meant to prevent using an indexed folder?
Yes
Yes, this would work in DEVONthink. But some apps donāt return a folderās POSIX path with a trailing slash while others do. This makes it impossible to reliably tell from a POSIX path whether itās a folderās or a fileās path. A folderās HFS path always ends with :
so this can be used to tell the difference.
Tx. Itās always amazing how complicated apparently simple things can become
Personally, Iād rather go for something like POSIX file thePath is a folder
, though. If thatās at all possible, of course. Can a path
of a record
in DT even be empty?
Update I found this one
tell application "System Events"
if anItem is package folder or kind of anItem is "Folder" or kind of anItem is "Volume" then
ā¦
end if
where anItem
is apparently an alias of a file. Definitely not simpler than your approach.
Thank you for the recommendation. But this doesnāt seem to work for entering DTās URL in Alfred.
Sorry - it was the best general Alfred DT workflow I could find.
Stephen