Possible to connect to Upnote?

So I’ve had a look at UpNote.

Unfortunately, it doesn’t have a Services or AppleScript interface. Nor does it expose any commands to Shortcuts. It does have a url scheme upnote: which might allow new note creation, but I can’t find any documentaton for it.

So we have to resort to nasty UI scripting with AppleScript:

#popclip
name: UpNote
icon: U
before: copy
applescript: |
  -- activate UpNote app
  tell application "UpNote"
    activate
  end tell
  
  -- poke it
  tell application "System Events"
    tell process "UpNote"
      keystroke "n" using command down -- new note
      repeat 100 times -- wait for window to actually appear
        if frontmost is true and number of windows is greater than 0 then
          keystroke "v" using command down -- paste
          exit repeat
        end if
        delay 0.05
      end repeat
    end tell
  end tell

(The above block is an extension snippet - select it to install the extension with PopClip)