How to create a link to external file


(Jason Craggs) #1

Greetings,

I’ve created a todo note to complete a manuscript review and would like to simply create a link to the pdf.
After much searching (mostly unsuccessful) I’ve learned a few things and have a few questions.
For example, this link works:
file:///Users/jcraggs/Documents/DEVONthink/JD.dtBase2/Files.noindex/tbx/3/LaTeX_info.tbx

However, these links do not work:
file:///Users/jcraggs/Box Sync/Manuscripts/ToReview/MS-to-review_2017_04_26.pdf

If I drag the pdf into tbx the whole file is visible. However, I would like to simply create a link to the file, not see the file itself. For example, in the text of the note would be ‘MS_ReviewDue_May5’ which would point to the path above.

Any help with these issues would be greatly appreciated.

Cheers.


(Eric Brown) #2

I typically use the $File key attribute, and then simply drag the file onto that attribute (alternatively, click on the folder icon and navigate to the file of interest). The file is now linked and all you have to do is click the folder icon to open it.


(eastgate) #3

Make $File a key attribute for your note. Then, drop MS-to-review_2017_04_26.pdf onto the “folder” icon of the key attribute, or click the folder and select the document you want. Now, that document will be linked to your note; select the note and it’s just a click away.


(Jason Craggs) #4

Thank you for the helpful suggestion, it accomplished my basic goal. However, I would still like to know how to create links within the body of the note. My reason is that I have another set of notes where I have several links within the body of the note. Specifically, when updating LaTeX, there are links to documentation for the packages to be updated. What I’ve done is simply drag the link to a Tinderbox note. As I didn’t create the actual links and haven’t been able to reverse engineer their creation I would like to know how to accomplish this task. Having this knowledge would also allow me to create a note about something I am researching and have links to various articles within the a single note. Does this make sense? If not, I could take a couple screenshots and upload them.

Cheers,
Jason


(Paul Walters) #5

Yes please. Illustrating the suggestion makes it easier to follow along.


(Jason Craggs) #6

Ok, I am hoping these upload correctly.
Please let me know if I can do anything else to help out.

On the left are links that work. I didn’t create them, just dragged them from another program.
On the right are my (failed) attempts to create embedded links like those seen on the left.
Any help would be greatly appreciated.


(Galen Menzel) #8

This will misbehave if the file path contains spaces, parentheses, or any number of other characters that either need to be encoded in the URL, or that the terminal application will escape with a backslash.

A nice trick is to drag a file into the address bar of Chrome or Safari. This will produce a properly formatted file:// URL to the file, which can then be copied and pasted as-is into a TB note. The pasted URL will be inserted as a link, so adding the link by hand with “Make Web Link” is not required.


(Jason Craggs) #9

Thanks galen, this trick worked!
My question now is how to turn that long path (file:///*.pdf) into a short, even one-word link? For example, like the links on the left side of the picture.

As always, any suggestions are greatly appreciated.
Cheers.


(Galen Menzel) #10

Rather than dragging and dropping the URL straight into the note, you can do the following:

  1. Copy the URL
  2. Highlight the note text that you want to link
  3. Go to Note -> Make Web Link…
  4. Paste the URL into the URL field of the popup window

Step 4 is typically unnecessary, since TB will automatically fill in the URL field with the contents of the clipboard if the clipboard contains a URL.


(Jason Craggs) #11

Wow, that was the simplicity I was looking for!
Thank you so much! I have no idea why I could not find such simple information on my own.

Now I have a couple of ancillary questions, if you have the time to answer.
In the web link popup window, what are the purposes and effects of

  1. The link type
  2. Target
  3. Title
  4. Class

Thanks for any help and/or point me in the direction of information already available.

Cheers.


(Galen Menzel) #12

Links in TB can have an associated type. For example, for a web link, you might want to differentiate between an “example” and a “definition”, so you can tag the links with types.

I’ve never messed around with Target, Title, and Class, but here is the page about them from aTbRef:

http://www.acrobatfaq.com/atbref7/index/Dialogs/CreateLinkpop-over.html

If you haven’t already found it, when messing around with TB, you should always keep a copy of the aTbRef site map open in your browser window. It’s a comprehensive reference to TinderBox (astoundingly maintained by a volunteer (and Tinderbox fanatic, one must assume)), and has an almost magical ability to resolve many of life’s confusions. (For example, I found the page linked above by just searching for “web link” on the site map.)


(Mark Anderson) #13

Thanks @galen: aTbRef basically grew out of me learning how to use Tinderbox and as HTML ex[port wax easy it seemed pointless not to share. A bit more on the target/title/class link terms…

The link type is really a internal thing stretches back to Tinderbox’s early days pre-database blogs. You don’t have to use link types. They were a bigger deal in the early days of (pre-Web) hypertext. Some folk like them, others don’t see the need. They’re there for when you need them. By default links are un-typed (OK, type ‘untitled’) and as such on maps have no link label. There’s no reason external links (i.e. ‘web links’ in Tinderbox parlance) need a link type but they are still links and sometimes it might be useful to be able to differentiate them from other links. Or, you might have web links that are basically a look-up, so might be a ‘glossary’ or dictionary’ type if that helps.

The Target, Title and Class relate only to HTML use, setting attributes of the exported <a> link element. The Target is a method to tell the web browser the (under-the-hood) name of the window in which to load the linked document. Default is blank the new document loads in the current window. Any other value, loads the new doc in a new window (or tab in modern browsers). More sophisticated use might target several different named windows. It is less used explicitly now mainly because such behaviours are often handled via JavaScript - which was a less developed/supported thing back in the early 200s.

Title is perhaps most obscure and also less used now. Its role is not to duplicate the anchor text of the note but to provide additional info for the HTML link and for this reason if a link has a ‘title’ attribute web browsers will show it as a tooltip when you mouse over a link.

Class sets the HTML link’s class attribute, i.e. the CSS class used to style the link. It may be that you want different types of styling for different links - or different type of links. Currently, class must be set manually per link - it is not possible to make all links of a given link type use a given CSS class.


(John Sidiropoulos) #14

You can use the “Copy Item Link”, “Copy Page Link” commands from DEVONthink and then just paste into the body of a Tinderbox note. For more information and two AppleScripts, you can read my blog post How to Create RTF links to files in DEVONthink.


(Paul Walters) #15

Over the years I (and many others) have posted numerous scripts on DEVONthink’s forum for producing item, page, and text links in RTF, HTML, and markdown format. Search for these topics on that forum for well-formed scripts.


(Jason Craggs) #16

@johnsidi and @PaulWalters
Thank you, I will look into these.


(Jason Craggs) #17

Mark,

Thanks for the great, and detailed, information. From what I can tell, these play an important role during the export process. Although, I still haven’t figured out how or why I would do such a thing, but I am sure this will come in time.

Are the title and class attributes used for exporting a tbx file into html format? I never considered using tbx for creating webpages etc. …


(Mark Anderson) #18

Yes, indeed title, target and class are used only in HTML export, and are used in defining HTML links as described above.


(Jason Craggs) #19

@mwra
Mark,
Thanks for the information. In your opinion, should I add these attributes in case I decide to export a tbx file sometime in the future?

I am seeking some practical help setting up a tbx for a grant I am writing, but will put that request in a separate post.

Cheers,
Jason


(Mark Anderson) #20

To clarify a possible terminology clash, ‘title’, ‘target’ and ‘class’ aren’t attributes within Tinderbox but optional data set per individual link (sadly, manually only - i.e. link by link).

When exporting to HTML, if they are populated the relevant data is used to create extra HTML attributes on the <a> links in the generated HTML output. Thus:
<a href="page.xml">some page</a>
vs
<a href="page.xml" class="special" title"some title text" target="new">some page</a>

You definitely do not need to use any/all of these 3 extras to generate valid HTML output. Indeed, unless you know that you want to use the HTML affordances those HTML attributes confer, I’d leave them blank.