Open With from Item Link

Hi all

I have Devonthink set so that when I double click it opens files externally. However I’ve noticed that if I follow a Devonthink Item Link to a file then it will open it in the Devonthink preview window rather than opening it externally. The files in question can’t be previewed in Devonthink so I just get a big icon and then have to open it manually. Its only a keystroke, so not the end of the world, but it would be nice if I could get it to do same as it does with double clicks.

Anyone had any success getting this behaviour to change?

Cheers

This behaviour can’t be customized currently, both DEVONthink and macOS assume that DEVONthink’s item links should be always opened with DEVONthink. What is actually the purpose of the item link in the document? Only to open it externally?

I use this script to grab a link (in markdown format) directly to the file in the file system.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application id "DNtp"
	
	set theLink to ""
	set the clipboard to ""
	
	try
		set theItem to (the first item of (the selection as list))
		if the type of theItem is not group then
			set myPath to the path of theItem as string
			set myURLPath to my encode(myPath)
			set theLink to "[" & (name of theItem as string) & "](file://localhost" & myURLPath & ")"
			set the clipboard to theLink
		else
			display dialog "Please select something other than a group"
		end if
	end try
	
end tell

-- Sub-routine provided by Rob Trew
on encode(strPath)
	do shell script "python -c 'import sys, urllib as ul; print ul.quote(sys.argv[1])' " & ¬
		quoted form of strPath
end encode

I link the item in Devonthink to its associated project in Omnifocus using Hook, just to save time when I want to look at the item. But Hook opens it in preview mode as opposed to externally because its just following a Devonthink link.

Thanks for this, this is really helpful. I’m using Hook which supports scripting & uses md links, but sometimes I might want to link to Devonthink proper rather than the file direct, such as to see where its filed or whatever, so Ill have to ponder how this would fit in with the overall workflow. But thanks for the headstart.

You might want to check with the team at Hook – they are very open to making different kinds of links work, and so they might be interested in an option to link to the file itself rather than the DEVONthink reference link. If would be an option for the scripts that Hook uses behind the scenes to create hooks. And, of course, with Hook you can change the scripts yourself (in Hook preferences), and Hook will use your custom script instead of the one that the app provides.