Script to copy Bear note title to the clipboard

Bear Version 1.8.5 (8888)
Catalina 10.15.7


Below is my feeble beginner’s appleScript attempt to simply copy the title of a Bear note (using the Mac OS Bear app) and it does not work. I simply end up with encodedTitle in the clipboard

thanks in advance for your time and help

tell application "Bear"
set encodedTitle to "$encoded_title"
	set the clipboard to encodedTitle as text
end tell

Bear does not support AppleScript as far as I can tell. It certainly has no AppleScript dictionary available, which would provide the functions and properties for working with it.

If you want to use AppleScript, you should be able to code some key presses after you have switched to bear:

  • Put the cursor into the Bear note.
  • Jump to the start of the note.
  • Select the line.
  • Copy to clipboard.

Bear has x-callback-url support, but I don’t see anything that would obviously help here.

Q) Where did you find the suggestion about encodedTitle?

1 Like

Thanks very much for your help.
I found "$encoded_title deep in the bowels of Hook which lists all scripts for different apps. See below.


  • Put the cursor into the Bear note.
  • Jump to the start of the note.
  • Select the line.
  • Copy to clipboard.

I can easily do this with keyboard maestro. An excellent solution. My only problem is how to select the first paragraph instead of line in case the title is multi-line.

There are 2 possible approaches (I am just guessing).

  • select first paragraph instead of line- is there a keyboard shortcut to do this ? I can ⌘↑ to go to the top → select paragraph → copy to variable or clipboard and I have what I want

  • I just thought of another idea, but have no clue how to implement it: The Bear Note starts with a so-called H1 header (green arrow). Bear apps are in markdown. If I copy paste the H1 to RTF, it translates as # followed by single space. Or if I am writing in markdown, I can write # followed by single space and it will automatically convert to H1 type paragraph.
    Please note that the title is the first H1. There are many other H1 in the Bear note.

thanks again very much !

set callbackURL to "hook://x-callback-url/link-to-new"
set partialURL to "bear://x-callback-url/open-note%3Fid%3D"
set encodedSrc to "$encoded_link"

set callbackURL to callbackURL & "%3FpartialURL%3D" & partialURL & "%26src%3D" & encodedSrc

set encodedTitle to "$encoded_title"
set myURL to "bear://x-callback-url/create?title=" & encodedTitle & "&x-success=" & callbackURL
set myScript to "open '" & myURL & "'"

do shell script myScript

get "hook://x-callback-url/link-to-new"

I found the solution with a keyboard maestro macro. Thanks to you. I am very grateful

it is not very elegant but it works