Possible to connect to Upnote?

would be great if there is a way to copy text , images by highlighting content (on web site or pdf page) to paste the content as a new note on UpNote

1 Like

Thanks for the great suggestion, that would require a new extension but should be straightforward if UpNote has the necessary mechanism for receivin text to make a new note. It’s just a case of me (or someone!) sitting down and making it. UpNote is on my big todo list of extensions.

thanks, I can see that your todo list is really quite long :rofl:

1 Like

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)

I managed to find some info about the upnote://x-callback-url scheme by looking at the source code to its Chrome web clipper. So here is an improved version:

#popclip - upnote v2
name: UpNote
icon: U
capture html: true
javascript: | 
  const article = {
    html: popclip.input.html,
    title: popclip.context.browserTitle,
    url: popclip.context.browserUrl
  }
  const encoded = encodeURIComponent(JSON.stringify(article))
  popclip.openUrl('upnote://x-callback-url/clipper?article=' + encoded)

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

Let me know if it works well for you.