Hook to New (Notes.app) Note?

I am receiving an error when I attempt to Hook to New (Notes.app) Note.

The script below successfully creates a new note, on its own. I’ve pasted the below script into the Scripts > Notes > New Item section

set NoteBody to "<pre style=\"font-family:System Font;font-size:14px;\">"
tell application "Notes"
tell account "iCloud"
	make new note at folder "Notes" with properties {body:NoteBody}
end tell
end tell

When I select a file and attempt to Hook to a New…, I select Notes.app, but then receive an error message:
Screen Shot 2020-07-26 at 08.54.38

Is this the fault of my New Item script? If so, what parameters am I missing?

Here’s a script we had in the app previously:

tell application "Notes"
activate
set noteID to «class seld» of ((make new note with properties {name:"$title"}) as record)
set noteID to text 14 thru -1 of noteID -- "x-coredate://noteID"
get "notes://" & noteID
end tell

Thank you. FYI - if you want the fonts to be consistent with body text, you need to add the HTML. This is working for me:

tell application "Notes"
activate
set noteID to «class seld» of ((make new note with properties {body:"<pre style=\"font-family:System Font;font-size:14px;\">" & "$title" & "</pre>"}) as record)
set noteID to text 14 thru -1 of noteID -- "x-coredate://noteID"
get "notes://" & noteID
end tell
1 Like

When you say “previously” — why don’t you do it anymore.

Some of the history behind Notes is listed here: Using Hook with Apple Notes – Hook.