Quickest way to copy the path of a file ?

Hi,

I work with Latex files all the time. In may of these files I have to refer to files outside, let this be an .eps figure or a bibtex file, which are also in my DT database. So I need to copy the path of those files into the Latex text. (I have the same problem while I am working on a MATLAB code and want to access data.)

I know I can go ahead and copy the Path information from the Info window and add the “Users/Me/Documents/Mydatabase.dtBase2/Files.noindex” to the beginning of that. However I would much prefer a quicker way to do this. Do you guys happen to think of any ?

For instance, a “Copy Path” option with keyboard shortcut similar to “Copy Link” option would be fantastic. Even being able to see the whole path in the Info window would be some help.

Cheers,

Ugur

This simple script does this, just save it in the folder ~/Library/Application Support/DEVONthink Pro 2/Scripts.


-- Copy path of selected item to clipboard

tell application id "com.devon-technologies.thinkpro2"
	set theSelection to the selection
	if (count of theSelection) is 1 then set the clipboard to (path of (item 1 of theSelection)) as string
end tell

Why not ~/Library/Scripts/Applications/DEVONthink Pro? Any reason to prefer one of the locations over the other?

I believe that the DTPO script menu is cached, and of course operates inside the current process, so it would be faster…

C

Thanks Christian ! Works great.

BTW, another novice question: is there a way to assign a shortcut to a script ? Or add a button to the toolbar ?

It’s briefly discussed somewhere like the manual, or the “about this menu” text, but:

…take a look at “Selected Text” in the “Rename” folder, and you’ll get some idea of how to assign a key combo to a script. It’s done by formatting the filename to include the key combo.

C

Thanks for the response.

I managed to do it using Quicksilver’s Custom trigger thing.

Ugur

This folder is only used by v1.x.

Hmm :confused: That’s where I install the Extras/Scripts/Examples scripts, plus a few others, and v2 can find them.

My fault, I’ve read ~/Library/Application Support/DEVONthink Pro instead of ~/Library/Scripts/Applications/DEVONthink Pro :wink:

I’ve thought of ~/Library/Application Support/DEVONthink Pro 2/Scripts as being more “app owned/managed” and ~/Library/Scripts/… as more “user owned/managed” even though Install Add-ons… can update both locations. I’m trying to make it as easy as possible to differentiate DTech vs. third-party (including my own) scripts.

So, we’re back to my originally asking whether you have any reason(s) to prefer/recommend one over the another. Maybe because of this:

?

Thanks for any enlightenment about it. :slight_smile:

I took Christian’s response to this thread:

http://www.devon-technologies.com/scripts/userforum/viewtopic.php?f=20&t=8528&p=39957#p39957

As an indication that scripts in the DTPO script menu were cached…

Best, Charles

That’s one reason. Another one is that the internal Scripts menu is always accessible.

I could sometimes care about that.

When DTPO is running. The external script menu is a bit more always accessible for me. :slight_smile:

So, there’s generally no technical reason that scripts need to be installed in and run from a specific location. Improved performance (e.g. with caching) and preferred accessibility might influence the choice, though.

Thanks for the responses.