I would find it very useful if I could configure certain document types (e.g. markdown) to open directly in my editor of preference by default, rather than opening in the DevonThink editor.
To provide a bit of context, I write everything in Markdown and never use the DevonThink editor for that. When I remember to select and press Shift+Cmd+O, I can do this in the DT UI, but when I’m following a document link using “x-devonthink-item://”, it always opens the DT editor.
Thanks for the reply. I’m not suggesting that a URL would launch an app other than DT. I realize that’s not possible. Perhaps my use of the word “directly” made things confusing.
What I am proposing is that, for configured file types, DT would “launch” the document (Shift+Cmd+O) instead of opening the document in its own internal editor (Cmd+O).
I’ve written some AppleScript that demonstrates how I envision this would work (hopefully the formatting gets through OK):
on user_followed_url(theUrl)
-- Extract UUID from URL
set theDefaultDelimiters to AppleScript's text item delimiters
set AppleScript's text item delimiters to "://"
set theUUID to text item 2 of theUrl
set AppleScript's text item delimiters to theDefaultDelimiters
tell application "DEVONthink 3"
-- get the record and its filesystem path
set theRecord to get record with uuid theUUID
set thePath to path of theRecord
--- determine how to open the document
if thePath ends with ".md" then -- TODO: specific file types configurable via preferences
tell application "Finder"
open (POSIX file thePath as alias)
end tell
else
open window for record theRecord
end if
end tell
end user_followed_url
Now, pretend the spirit of this code was integrated into DT. Clicking a URL would still activate DT, but DT would decide what to do next based on file type. The user would probably see DT activate for a split second before ending up in the document’s external application. Technically, I suppose DevonThink would be acting as a proxy for opening the document in its default application.
This is a good work-around, but the ideia of being able to do it directly isn’t bad either. If I am not mistaken, this what Hook does (amongst other things I imagine).
There is an Alfred Workflow I use to get around my main database more quickly. Inspired by this thread, I just added the option to open records externally. Not exactly what was being requested here, but perhaps it can be useful. The only downside is that you have to manually get the links for the records and drop them as a CSV unto the Alfred list filter.
There is also this workflow to search DT3 that has the option to open records externally as well:
I find Launchbar invaluable for this; from a DEVONthink window with items selected, ‘instant send’ them to Launchbar, then press ⇥ and choose what to launch with, or press to open with the default file handler as registered in Finder (or Launchbar!)
@Bernardo_V I like your idea and wanted to take a look at your Wiki - Dummy.alfredworkflow, but Dropbox says that it has since been deleted. Would it be possible for you to make it available again? Cheers!