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.
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
It doesn’t matter, very happy to communicate with you.
I previously forgot to ask this: Where do you get these DEVONthink links from?
I ask because I can’t imagine a scenario where I would have a plain text DEVONthink link and wanted to open its file in another app.
So what’s the scenario?
I bet you didn’t tell him that someone already wrote an AppleScript to open the file …
The problem of opening is solved. Your problem is that you don’t know how to tell Alfred what it should process. You need to find a way to deliver Alfred your input. Without input no workflow.
I often use a software called Hook (https://hookproductivity.com) to get DT’s file links and link two or more files in both directions, the trouble is that some software does not support url scheme, so I can only write down DEVONthink links to quickly open the relevant files.
I would 100% like to be able to process PDFs directly in DT, but unfortunately I need to process a lot of PDFs that contain Chinese, and if I do it internally in DT (e.g. highlighting or notes), all the Chinese in the PDF will be garbled (according to the official response from DT, this seems to be due to the PDFkit framework of macOS) and cannot be fixed by DT)
You are right, I will add to him.
Try this in Alfred
In the Workflow you created:
Run Script
action by dragging from its right side onto the Run Script
actionOn Alfred’s left side:
Features
tab (above Workflows
)In the sidebar:
Default Results
In the main area:
Setup fallback results
In the new window:
+
at the bottomWorkflow Trigger
Done!
Now when you invoke Alfred and paste a DEVONthink link you should be able to select the workflow that will open files in their default app.
Great!
If you want a nicer icon: