11. Integration ↑
11.2 APIs for Hookmark Integration
Notenik now has some minimal AppleScript support, developed specifically to allow integration with the Hookmarkmark app.
AppleScript Commands
The following AppleScript commands are available.
GetSelectedNoteTitle – Returns the title of the last selected Note, from the frontmost Collection. No input parameters needed.
GetSelectedNoteBacklink – Returns a Notenik Custom URL pointing to the last selected Note, from the frontmost Collection. If a timestamp field is available, the returned URL will make use of that. No input parameters needed.
GetSelectedNoteFilePath – Returns the file path pointing to the file containing the last selected Note, from the frontmost Collection. No input parameters needed.
AddNote – Adds a new Note to the frontmost Collection, using three input parameters: title, link and tags. Returns a backlink to the new Note, if it was added successfully.
Sample Scripts
Following are examples of how these commands might be used to enable Hookmark integration.
Get Address
The following script might be placed beneath the Get Address
tab in the Scripts section of Hookmark Settings.
tell application "Notenik"
if HasSelectedNote then
set theTitle to GetSelectedNoteTitle
set theUrl to GetSelectedNoteBacklink
return "[" & theTitle & "](" & theUrl & ")"
end if
end tell
This script allows Hookmark to ask for the Title and the Backlink (see Custom URL Scheme) of the last Note to be selected. This information then allows Hookmark to later communicate with Notenik in order to pull up that same Note.
New Item
The following script might be placed beneath the New Item
tab in the Scripts section of Hookmark Settings.
tell application "Notenik"
return AddNote title "$title" link "$user_link" tags "hook"
end tell
This script also returns the backlink to the Note of interest.
Tips for Hookmark Integration
You will want to make sure the Timestamp field is included on any Collection you wish to use with Hookmark. This field allows Hookmark to reference a Note even if it has been renamed.
Also note that, when Hookmark communicates with Notenik, it will get info and add info to the frontmost Collection, if you have more than one open.
Next: 11.3 Actions for Shortcuts