C-Command Software Forum

Create a custom record hyperlink in Note with Applescript

Not sure if this is possible in EagleFiler, or maybe is more a RTF formatting question than an EF one, but since I was trying and the doubt came, here goes…

In one of the libraries I usually have a PDF file and a Markdown file with notes taken from the PDF. Both files have the same filename, for example, “Doe 2020” but different extensions, either pdf or md respectively. In EF, we can “Copy Record Link” and paste it in the Note field and with a click it is possible to quickly navigate between the two files, and importantly for me the provenance of both files is easliy retrieved.

I was trying to automate this with an Applescript to “link” two files in EF so that when I drop the markdown file in the library I don’t have to search manually for the source pdf file and repeat the copy-paste operation on both records. The script is working correctly but I can’t seem to be able to have clickable links in the records’ notes this way. My workaround is to have a Markdown link (eg. [text](hyperlink)), but again is not clickable, it’s just there to show where the record came from.

I don’t understand at all RTF, so maybe there’s something wrong with the syntax, although it seems to be properly formatted (ie. a clickable link with only Doe 2020 as text) when I copy the resulting text below to TextEdit and save as rft:

-- applescript
set srcFile_title to theRecord's title
set srcFile_URL to theRecord's URL

set srcFile_link to "{\\rtf1{\\field{\\*\\fldinst HYPERLINK \"" & srcFile_URL & "\"}{\\fldrslt{\\ul\\cf1" & srcFile_title & "}}}}"

set note text of targetRecord to srcFile_link
--only creates the literal text in the Note of EF
--{\rtf1{\field{\*\fldinst HYPERLINK "x-eaglefiler://open?library=~/Documents/Research-Papers/Research-Papers.eflibrary&recordGUID=OR-A8ecqQVG7yu0eE0GC5g"}{\fldrslt{\ul\cf1Doe 2020}}}}

or maybe this is not possible with EF?

Many thanks.
Pedro

The note text scripting property is interpreted as plain text, so it’s not possible to create a clickable link this way. The first time you want to click the link in the note, you could select it and choose Make Link from the contextual menu.

I’ll look into adding a note RTF scripting property so that you can set the RTF directly.

Please try the public beta of EagleFiler 1.8.12b1. It adds note RTF and note HTML scripting properties, which let you set links and other rich text attributes on the record’s note.

With the new public beta and using note RTF property the RTF hyperlinks are shown correctly formatted and work as expected.

This is really wonderful. Many thanks for this.