I notice in DT (Mac) in some places has double click as open with the default application, and in other places open with the DT viewer. Is it possible to always have double click open with default?
No, this is not possible (and has been discussed at length here).
Check this out: Tuesday Tip: Editing options in DEVONthink
Thanks Bluefrog. Itâs a shame it canât be changed - a simple option is all it would take to suit both workflows instead of a âmost people wanted thisâ approach.
Actually, itâs not so simple an option as the preference would likely be very situational. There are many times someone would want to use the default app when double-clicking, then times when theyâd want to open it in DEVONthink. This is why the current option is in place, as well as providing the Open With menu.
Yes, but the default is learning towards a certain workflow. Most other apps have an option to choose one lean or another lean. Thatâs what options are for!
Itâs just a simple reversing of the workflow. Itâs not hard to implement. And, after using thousands of software programs itâd certainly help someone like me who double clicks on things to open in the app, because thatâs the default behaviour in the OS and every app that follows suit.
Letâs beat this dead horse a bit, shall we?
I know itâs been stated that the majority of users prefer the current behavior, but in case anyone is still counting votes, I would (very much) prefer that double-clicking would open documents in their default applications. Itâs not âsituationalâ for me. I never want to open documents for editing inside DEVONthink. Count me as part of the âI would really like an option for this behaviorâ camp.
I understand and agree with the argument against adding preferences willy-nilly. However, at some point the pressure to add an option might justify a small amount of additional complexity.
There are compromises Iâd make in order to have the âOpen in Default Applicationâ preference. For example, I personally could live without the following existing preferences:
- Import->iChat & Yahoo! Messenter logs (still relevant?)
- Media->Play Movies [Automatically | Loop] (does a majority want this option?)
- Media->Markdown [Edit documents | Preview documents] (also already has easy keyboard access)
And what about a âHiddenâ preference? Or do those add too much to the support burden?
Anyway, I know this request is likely already considered âClosed, Wonât Fixâ but Iâve been using DEVONthink for years and still havenât trained myself to not double-click files when I want to open them in their default applications.
Nearly all of my surprise reactions to DEVONthinkâs behavior are, âWow, cool! I didnât know it could do that!â. The double-click behavior might be the only thing about DT that causes me undue friction multiple times every day.
Thanks for listening.
Jack
Youâre absolutely right here that different people have different workflows. And even though we have discussed this already at length in the past and settled for one way, this is not hammered into stone. So we might offer an option here (even though we strongly try to not add more options and fall into the featuritis trap) in a future version. At least itâs on our â(re)consider listâ.
Great to hear that!
Thank you. Your willingness to take another look at it is much appreciated. If it turns out that you continue to feel it adds more complexity than itâs worth, then so be it .
Jack
One of my main uses for DTPO is to maintain permanent links within scientific notebooks, and the current behavior of DT causes some friction.
I document scientific processes in the lab with, for example, textedit (rtfd), and within those notes are links to other notes. So my notes page will have lots of links like x-devonthink-item://46EâŠ350. Because I keep all my lab notes (and my studentsâ notes) indexed within DT, we get the huge benefit that the links donât break if I ever move/rename things. The downside of DTâs current behavior of opening docs within DT is that when we click on a link to another file, it opens in within DT rather than within Textedit. Thatâs not ideal, since we really want to use Textedit for its ability to deal with embedded images etc. So, each time we click a link to another note, we then have to do a cmd-shift-O to open another copy of the note within textedit. Then to reduce clutter we go back to DT and close the doc within DT, and then switch back to Textedit to edit the linked note. Not a big deal to do once, but more so to do 100 times a day. Is there an equivalent to cmd-shift-O that I can use with a link to tell DT that the link Iâm clicking on should be opened with the default app rather than DT?
Thank you for any thoughts on this,
Carl
P.S. The problem is even more of an issue if, say we open a main note that links to 10 other notes that we need to have open for editing. If we click on those 10 links, now we have 10 DT docs open. We then have to go through each DT doc and do a cmd-shift-O to open them in textedit. But thereâs no good way to know which of the 10 youâve already done cmd-shift-O to, and so you have to move each one to a new window so you can keep track of which ones youâve already reopened in the correct app.
I recently wrote a script that looks up and opens links. It opens them in DEVONthink, so I made a version for you. Select your link(s), or the whole page, run the script and it will open them in the default app.
It uses macOS System Events
to copy selected text so it may be that you have to increase the delay if you use it via shortcut (e.g. via Alfred or Keyboard Maestro) as thereâs a chance that once in a while you donât let your triggering shortcut go fast enough which will let macOS register your shortcut plus the shortcut System Events
presses. However waiting 0.5 (or more) seconds should be no problem if you donât have to open and close all those DEVONthink windows. If you use it via DEVONthinkâs menu or toolbar thatâs of course no issue.
-- Open selected text's link(s) in default app
property theDelay : 0.5
tell application id "DNtp"
try
set theWindow to think window 1
try
set selectedText to selected text of theWindow & "" as string
delay theDelay
activate
tell application "System Events" to tell process "DEVONthink 3" to keystroke "c" using {command down}
try
set theGrepResults to do shell script "osascript -e 'the clipboard as «class RTF »' | perl -ne 'print chr foreach unpack(\"C*\",pack(\"H*\",substr($_,11,-3)))' | egrep -o 'x-devonthink-item[^\"]*'" -- https://superuser.com/a/1409995/
on error
display alert "No link(s) found" buttons {"Ok"} default button 1 message "" as critical
return
end try
set theRefURLs to paragraphs of theGrepResults
on error
display alert "No text selected" buttons {"Ok"} default button 1 message "" as critical
return
end try
repeat with thisRefURL in theRefURLs
set thisPath to path of (get record with uuid ((characters 21 thru -1 in thisRefURL) as string))
tell application "Finder" to open file (POSIX file thisPath as alias)
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
Wow! thatâs an unbelievably quick reply. Iâm not a scripting expert, but I think I know enough to give this a try. Thank you very much for taking the time to post this!!
So I dropped it into Alfred w/ a shortcut of âdtodâ, selected the DT link within textedit, and ran the script. Unfortunately, no joy. I turned on debugging within Alfred and get the following error (which is already past my scripting expertise). I did also try selecting the link within DT to see if that helped, but got the same result. Apologies if itâs an obvious mistake Iâm making here.
[16:44:46.062] Logging StartedâŠ
[16:45:00.204] DT (open in default) (dtod)[Keyword] Processing complete
[16:45:00.211] DT (open in default) (dtod)[Keyword] Passing output ââ to Run NSAppleScript
[16:45:00.211] ERROR: DT (open in default) (dtod)[Run NSAppleScript] {
NSAppleScriptErrorBriefMessage = âExpected \U201cend\U201d but found \U201cproperty\U201d.â;
NSAppleScriptErrorMessage = âExpected \U201cend\U201d but found \U201cproperty\U201d.â;
NSAppleScriptErrorNumber = â-2741â;
NSAppleScriptErrorRange = âNSRange: {70, 8}â;
}
Sorry, wrote it for usage in DEVONthink. It should be no problem to change it so that it works in any app, but Iâm running a backup right now. After that Iâll change it
I did get your original script to run from within DT. I could not however get the new version to run even from within DT. Thank you for looking at this error.
This version should work from within any app. Tested with TextEdit, Nisus Writer and TextSoap.
-- Open selected text's link(s) in default app
property theDelay : 0.5
try
delay theDelay
tell application "System Events" to tell (first process whose frontmost is true) to keystroke "c" using {command down}
set theGrepResults to do shell script "osascript -e 'the clipboard as «class RTF »' | perl -ne 'print chr foreach unpack(\"C*\",pack(\"H*\",substr($_,11,-3)))' | egrep -o 'x-devonthink-item[^\"]*'" -- https://superuser.com/a/1409995/
on error
display alert "No text selected or no link(s) found" buttons {"Ok"} default button 1 message "" as critical
return
end try
tell application id "DNtp"
try
set theRefURLs to paragraphs of theGrepResults
repeat with thisRefURL in theRefURLs
set thisUUID to (characters 21 thru -1 in thisRefURL) as string
set thisRecord to get record with uuid thisUUID
set thisPath to path of thisRecord
tell application "Finder" to open file (POSIX file thisPath as alias)
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell
There are two AppleScript actions in Alfred, the one you need here is
then in this actionâs first dropdown
Replace the example code with the script and it should work.
This partially works for me. After it correctly opens the file corresponding to the link in the default app, DT throws an error: âCanât get path of missing value.â So if a single file is selected, then the file will open correctly, and then one needs to go to DT and click âokâ on the error dialog. This wouldnât be that much of an issue except that it seems to interrupt the script. So if youâve selected several files, the first will open, then you click âokâ, and that causes the script to exit.
Even as is, the script is an improvement over the vanilla DT functioning here, but a script that just looks through a selection for links and opens them all in default apps really would be a brilliant addition to my labâs workflow. So if you have time for any further thoughts, they will be greatly appreciated.
Alfred debug shows the following if I run it with one link in the selection:
[21:40:12.019] DT (open in default) (dtod)[Keyword] Processing complete
[21:40:12.025] DT (open in default) (dtod)[Keyword] Passing output ââ to Run Script
So that seems consistent with it running correctly with the link in the selection, but then passing it a blank. Iâve tried to make sure Iâm not passing any arguments to the script within alfred, and that it isnât expecting an argument. Beyond that, Iâm not sure why itâs getting a null input.
Hm, itâs working fine over here
I could add a try block, but you should not get any errors with the current version. Donât know what it might be.
No thatâs not causing the error, my debug looks the same after opening more than one link.
[03:49:14.904] TEST - ausgewÀhlte Links in Standard App öffnen[Keyword] Processing complete
[03:49:14.906] TEST - ausgewÀhlte Links in Standard App öffnen[Keyword] Passing output '' to Run Script
Seems DEVONthink couldnât get the record but I have no idea why. I would understand an error from Finder like âcanât get pathâ if one selected a link to a smart group, as those have no path, but Iâve never seen DEVONthink not getting a record.
Donât know how to solve that other than adding a try block.
-- Open selected text's link(s) in default app
property theDelay : 0.5
try
delay theDelay
tell application "System Events" to tell (first process whose frontmost is true) to keystroke "c" using {command down}
set theGrepResults to do shell script "osascript -e 'the clipboard as «class RTF »' | perl -ne 'print chr foreach unpack(\"C*\",pack(\"H*\",substr($_,11,-3)))' | egrep -o 'x-devonthink-item[^\"]*'" -- https://superuser.com/a/1409995/
on error
display alert "No text selected or no link(s) found" buttons {"Ok"} default button 1 message "" as critical
return
end try
tell application id "DNtp"
try
set theRefURLs to paragraphs of theGrepResults
repeat with thisRefURL in theRefURLs
try
set thisUUID to (characters 21 thru -1 in thisRefURL) as string
set thisRecord to get record with uuid thisUUID
set thisPath to path of thisRecord
tell application "Finder" to open file (POSIX file thisPath as alias)
end try
end repeat
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
end try
end tell