The technique above works very well for most file types - even those without special app-specific URLs . Instead of (or as well as) storing paths to local files in File-type attributes, you can link to them using a file:// URL instead of http:// URL.
For the less tech readers, here's an example, where I'll link to the "About Stacks.pdf" file in my Documents folder. First I need the full POSIX path of the file (
how? or see ** below), which gives me:
'
/Users/mwra/Documents/About Stacks.pdf'
Note that we need the full path; don't use one with a' ~' start as it won't work. Now, I copy that file path to the clipboard. Then in your TBX's $Text, I select the desired anchor text and press Shift+Cmd+L to make a new web link. In the dialog's 'URL' box, change the default 'http://' to 'file://' and then paste in the path
at the end of the existing text, thus:
http:// ->
file:// then paste the clipboard contents after the last '/'. Like this:
file:// + /Users/mwra/Documents/About Stacks.pdfgiving:
file:///Users/mwra/Documents/About Stacks.pdfYes, there should be
three forward slashes. Click OK to close the dialog. Now use the Cmd+Opt+Click method to open the file as @David describes above.
Using v5.10.1 I've just opened a series of local files: XML into BBEdit, PDF into Preview, TBX into Tinderbox, etc. Exactly which app OS X will chose with which to open the app may vary from Mac to Mac depending on what apps you've got installed.
Of course for apps with their own special URL forms, like DEVONThink, just use those instead of file://.
Bear in mind you're saving a literal OS path and not an OS alias, so if you subsequently move the file the link won't work. Not tested, but if think the file might need to move, you could probably make an OS alias for your file and link to that; leave the alias in situ and move the target file as required.
I know this looks like lots of work but it's much simpler than it appears and very easy after you're done it the once around.
** Another simple trick to find a file's OS path is to display $File as a key attribute. Then drop a file (or an alias to it) from Finder onto the File button in the sidebar. You can now cut the $File value to the clipboard leaving $File empty for further use.