Script for opening files with the relevant default program

I’m new to the forum and to DT and I’m useless with AppleScript. I have a few questions/requests on issues I haven’t been able to resolve on my own. In the spirit of DT best practices, I figure I should create separate posts in order to disagreggate these issues and facillitate future searches.

Okay, my first question/request: Is it feasible to create a script for opening files with the relevant default program?

If so, one could attach it to files via the info panel or execute the script via the script menu or key combo. The idea is to create a generic script simply directing DT to execute the “open with default program” function on the selected or opened file.

Two posts indirectly addressed this issue: one by Poetsfolly in 2005 ([url]trigger script without opening record]) and another by resting just recently ([url]Choice of Double click to open with default program]). If you take a look at the posts you’ll notice that the users’ desire to facillitate opening files in external programs was poo-pooed (unfairly I think) and the issue dropped. Perhaps this reflects some DT policy to discourage users from using the “open with default program” function but that would be unfortunate.

In any event, my question: is the script I envision feasible? If so, would some skilled user please write it?

Thank you kindly!

I expect that one could create a script to do this, but do you really want to manually attach a script to hundreds, or possibly thousands of files in your database(s) and then have those documents automatically open in an external application each and every time you select the documents in the database?

You already have this ability now. When a document is selected, command-shift-o will open the document in the default, external application. The command is also available from the menu (Data>Open With) and a toolbar icon/command (Open Externally).

Sure. But … why? DEVONthink already does what was suggested, and in several ways built into the program:

Adding to Greg’s note:

The “Open Externally” icon can be added to any toolbar using View > Customize Toolbar – the icon is this:

A script attached with the Information panel would normally be what’s called a “triggered” script – meaning it executes every time the document to which it is attached is clicked. I can imagine that it would quickly become an annoyance if documents pop open in an editor merely by looking at them.

Am I not understanding something?

I agree with korm and Greg. The question isn’t, “Can I ?”. The question is, “Should I ?” (Actually, as alluded to by korm, the question is, “How quickly is this going to tick me off when if I even accidentally touch a file Photoshop (or whatever) is popping open!?!”

I think the real utility would be outweighed by the potential annoyance.

Oh brother, what a newbie question I posed! Your replies made perfect sense.

To explain where I was coming from:

  1. I assumed you could attach a script to multiple files at once by selecting them, opening the info panel and attaching the script.

  2. I didn’t realize that the script is triggered by merely clicking on the item. On reflection, I see that clicking on an item does open it in most views (but not in list view). Duh!

  3. I didn’t realize it was such a simple key combo to open with the default program. Still, I would prefer the option to reverse things: double-clicking on the file to open with the external program and a key combo to open the file in a new window within DT. This would be useful since in most views (as I realize now) the file does already open within DT, in the main window (if that is what you wanted). Unless, there is something else that I’m not processing, I think it would be nice to have a script that does this reversal: when a file is opened (cmd-O or double-clicking), the script tells DT to close the new DT window and instead open the file with default program. Is that feasible (assuming you call attach a script to multiple files at once)?

Thank you for your patience!

Essentially, the suggested script would press shift-command-O whenever you double-click or press command-O – why not just press shift-command-O?

Attaching a script to multiple files doesn’t reduce the annoyance factor, in this case, it magnifies it across a bigger chunk of the data base.

A few additional thoughts that might be helpful.

You can attach a script to multiple files at once as you described, however every time you add new documents to the database you would need to select them, bring up the info panel, navigate to the script’s location on your HD to select it, etc. The process would become tiresome after time, even if the other behaviors of attaching a script were not.

To simplify the discussion of opening documents internally/externally;

  • command-o will open the document internally (assuming that the filetype can be opened internally by DEVONthink),

  • command-shift-o will open the document in the external app associated with the document,

  • command-shift-o will still open the document in the external app, even if it is already open internally (command-o) in DEVONthink,

  • and of course command-w will close a window that is opened internally in DEVONthink. I run all the operations exclusively from the keyboard.