I’m aware of Notebook’s limitations with Hook as they are described here and with similar apps that retain the literal file path associated with a Hook link instead of the App-unique url (e.g. Hook will Hook a note to
/user/Documents/Notebooks/My Hook Note in Notebooks.txt instead of
notebooks://show/My Hook Note in Notebooks.txt).
I was wondering if it was possible to work around Notebook’s limitations when Hooking to a new Note in Notebooks by devising a New Item script that will set a variable
notePath to the
path of the New Note and return the URL
notebooks://path, for example.
I’ve cobbled together this so far to no avail:
tell application "Notebooks" activate tell application "System Events" tell application process "Notebooks" tell menu bar item "File" of menu bar 1 click click menu item "New" of menu 1 click menu item "Markdown" of menu 1 of menu item "New" of menu 1 end tell tell menu bar item "File" of menu bar 1 click click menu item "Save" of menu 1 end tell tell menu bar item "Edit" of menu bar 1 click click menu item "Insert Date" of menu 1 end tell end tell end tell delay 0.5 set notePath to path of document 1 return "notebooks:/" & notePath end tell
I have near-zero understanding of AppleScript. My difficulties thus far are two-fold:
Hook does not seem to abide by this script at all. Although it will make a new document in Notebooks, I imagine it is only registering my custom template that allows me to make a markdown file that opens specifically in Notebooks.
The result of the line
return "notebooks:/" & notePathyields me nothing except
notebooks:/when testing in Script Editor. It seems like the script is not properly retrieving the
pathof the document for some reason.
Is what I’m looking for at all achievable with Notebooks current limitations in mind? Is this something that I need to instead ask its Developer?