Tinderbox Forum

Opening a folder from a link in a note

Hi,

Maybe there is an easy way to do this but I have been unable to find the necessary information in the documentation I have consulted.

What I would like to do is pretty simple.

I have different projects associated to different folders in my computer. In those folders and subfolders I store certain types of resources connected to different parts of the project.

I want to be able to open a particular folder in Finder when I click on a link inside a particular note.

Creating a link with the path to the particular folder does not work. How can one go about creating this functionality?

Thanks in advance.

JM

This works for me:

  1. In Finder, right click the file to link to, press the option key, and choose “Copy as Pathname”
  2. In Tinderbox, in the note, select the text you want to be the link anchor for your link.
  3. Choose Note > Make Web Link. In the dialog that opens, type file:// then press ⌘V to paste the path on the clipboard that you copied in Step 1.

You should have a clickable link that will open that file. Something like this:

file:///UserName/Destop/MyFile.docx

Another method – actually a lot simpler – is to use a file-type attribute in your Key Attributes list. See this for more info.

Clicking the blue icon in that attribute in KA will open a Finder window in which you can browse and select the file to add to the attribute. Then, clicking the icon again will open that file.

1 Like

I’d assumed this only worked with files but happily folders too. The path syntax, having tested to remind myself, is:

Folder: file:///Users/[username]/Desktop
File: file:///Users/[username]/Desktop/file.ext

Replace [username]with the user name as seen on your own system. not the folder call doesn’t take slash at the end. Folder links open, as you might expect in Finder. I’d agree with @PaulWalters that the File-type attribute (as a key attribute) can be a tidier easier-to-set method. But, you have two options.

As a slight aside, the pseudo-protocols offered by some apps—DEVONthink, Bookends, MarginNote,etc.—where the file:// part becomes something like bookends:// can also be used in a $Text ‘web’ link (or a URL-type attribute).

One other note. Sometimes folks wonder why these URLs begin with file:/// rather than file://, which looks more like a web URL. It is because file: links begin at the root of the disk, and / is the symbol for “root”. So, it is appended to the basic file:// identifier to become file:///.

TMI perhaps.

1 Like

No, in information plumbing there is never TMI. Indeed, TMI FTW!

I laugh, as I almost thought to make the same point and didn’t lest I seem you be nit-picking your informative and useful post above. :joy:

Thanks again for such fast and helpful responses!! It turns out the problem was precisely the lack of a ‘/’ after ‘file:’ I only had two ‘/’.

Thanks also for pointing to the file-type attribute solution. I knew of the existence of this attribute but I didn’t know you could use it like this. In my case the link solution is more useful because I have a note containing pointers to different folders. It was cool to see that clicking on the folder icon on top of the note would open the folder in Finder, though :slight_smile:

I have another little challenge for you guys. Just after fixing the problem with the links it occurred to me that if I open the Tinderbox file on a different computer (my laptop, for instance), I won’t be able to go to the linked folders because the name of the Home folder will be different.

The rest of the path would not be a problem because all of the relevant folders are stored under the Dropbox folder which is inside the Home folder and so the path would be the same in all computers after the home folder. The different names for the Home folders in different computers will be a problem, however.

Can anybody suggest a solution for this? I’m thinking that the only way out of this is resorting to scripting. Creating an applescript that replaces the name of the Home folder for the adequate name in each computer would do the trick, I think.

I can consult an applescript manual to figure out how one would do that but the problem is that I don’t even know how to integrate scripts in Tinderbox (i.e. how to call a particular script from within TB). Is there any tutorial on how to work with external scripts in TB? I haven’t been able to find any info in the official Tutorial.pdf

Josep M.

You can have as many “file” type attributes in your document as you wish – just create more of them.

If you have a web link such as

file:///Users/Me/Desktop/My%20Treasure%20Map.jp2

and you want it to work on other machines that also have that file in the Desktop folder, then use

file:///~/Desktop/MyQ%20Treasure%20Map.jp2

Now, this works but it is a macOS mistake that it works. Using “~” should substitute for /Users/Me and therefore eliminate the need for the third slash, but it does not. Go figure.


FWIW, I think using AppleScript to solve the multi-machine issue would be a horribly frustrating exercise. Just saying.

Deleted, @PaulWalters beat me to it. Plus, his answer was better. :slight_smile:

1 Like

Thanks again. This was pretty obvious but I guess it wasn’t so obvious for me at the time.

In spite of the fact that AppleScript might have been an overkill for this, I’d still like to learn a little bit more about its integration with TinderBox. Are there any tutorials or documentation that provide basic information on this topic?

Given that there is an applescript dictionary for Tinderbox, it seems pretty straighforward to create a script that starts with "tell application “Tinderbox 8"” … do something from outside TB.

What I’m wondering, though, is if there is some further degree of integration beyond this. For instance, is there anyway to trigger an applescript from within TB? via, say, an action?

JM

You can use runCommand to run a script

@ComplexPoint and @cremoer and others have done some nice work with Tinderbox scripting – browse this forum for their contributions.

OK. Thank you!

JM

Perhaps:

Note > Make Web Link

(Rather than File > Make Web Link ?)

Yes, this was a typo. I figured it out. Thanks, though.

JM

Easter egg. :egg:

You found it!

2 Likes