Help: Need AppleScript example to simply link a filename with two web pages (and their associated titles)?

I am trying to programatically hook a series a download files with their 2 associated webpage links (download link url and about url)

For each file I have the following information – Example:

filename:      /Users/DM/Downloads/AmadeusPro_v2.8.13.dmg
downloadTitle: Amadeus Pro 2.8.13 (2662) Beta
aboutTitle:    Amadeus Pro - The swiss army knife of sound editing

I’ve tried to use the Hookmark’s Command Line Interface (CLI) documentation to use shell out to the CLI to achieve the desired linking.

I have posted Brett on the github issue tracker as follows:



cat temp.tmp
This is just a test download file

hook list -ov temp.tmp
No bookmarks

hook list -ov
No bookmarks


hook link “[web title](](” “[file title](temp.tmp)”

Linking and /Users/dennismisener/work/Nim/temp.tmp...
Linked 1 files to /Users/dennismisener/work/Nim/temp.tmp


link list -ov temp.tmp

Bookmarks attached to /Users/dennismisener/work/Nim/temp.tmp


link list -ov

Bookmarks attached to

Title: temp.tmp
Path: /Users/dennismisener/work/Nim/temp.tmp
Address: hook://file/byJgwypqK?p=d29yay9OaW0=&n=temp%2Etmp


The supplied title information seems to be ignored.

  • Am I using an incorrect syntax?
  • Is there another way to specify the title information?

I was wondering if I could directly use an imbedded AppleScript API snippet to achieve the same thing (bypassing the overhead of the ruby invocation, since I have hundreds of these linkages to make).

I’ve unsuccessfully searched the forum for something to start with but didn’t find any examples with linking with title information.

Any assistance would be appreciated.

Sorry we missed your question, @DMisener .

Here is an example of AppleScript that you can use to link two bookmarks. Please let us know if you have any questions.

Thank you

tell application "Hookmark"
	set myBookmark to make bookmark with properties {address:"", name:"hello1"}
	set myBookmark2 to make bookmark with properties {address:"", name:"hello2"}
	hook myBookmark and myBookmark2
end tell

Continuing the discussion from Help: Need AppleScript example to simply link a filename with two web pages (and their associated titles)?:

Thanks… modified it slightly so I could use it from Nim.

The following test is shows that it works fine for me:

import applescript

bookmark n [inh. item] : A hookable reference to a file or document.
contained by application.

 - name (text)                              : The name of the bookmark.
 - address (text, r/o)                      : The URL of the bookmarked item.

 - path (text, r/o)                         : The POSIX path of the bookmarked item, or "" 
                                              if bookmarked item is not an available file.

 - hooked bookmarks (list of bookmark, r/o) : List of bookmarks which are hooked together with
                                              the bookmarked item

proc hookApp*(address1, name1, address2, name2, address3, name3: string) =
  let code = """
    tell application "Hookmark"
      set myBookmark1 to make bookmark with properties {address:"{address1}", name:"{name1}"}
      set myBookmark2 to make bookmark with properties {address:"{address2}", name:"{name2}"}
      set myBookmark3 to make bookmark with properties {address:"{address3}", name:"{name3}"}
      hook myBookmark1 and myBookmark2
      hook myBookmark1 and myBookmark3
    end tell

  discard code.script @[
    ("{address1}", address1),
    ("{name1}", name1),
    ("{address2}", address2),
    ("{name2}", name2),
    ("{address3}", address3),
    ("{name3}", name3)

when isMainModule:
    "test file",
    "test web1",
    "test web2"