How do I create a new text note from highlighted text in any app?

I have just created a macro to create a new note in the notes app from highlighted text in any app. However, it works erratically.

How do I get it to work consistently?

You may want to try adding delays between relevant steps. I’m guessing the app doesn’t have time to update itself before the macro sends each command

delay 1.5

I’d try smaller values until you can still consistently get the macro to work as you like

Hey Mirizzi,

Write a more consistent macro? :smile:

* Cmd-C
* Pause 0.05
* AppleScript:

# Auth: Christopher Stone <>
# dCre: 2015/04/29 23:54
# dMod: 2015/04/30 00:08
# Appl: Notes
# Task: Make a new note with content from the clipboard.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script,, @Make, @New, @Note, @Clipboard

set noteName to "Jotted Down: " & (do shell script "date '+%Y/%m/%d %H:%M:%S'")
set noteHTMLText to "<pre style=\"font-family:Menlo,sans-serif;\">" & (the clipboard as Unicode text) & "</pre>"

tell application "Notes"
  if running is false then run
  if not (folder "Notes" exists) then make new folder with properties {name:"Notes"}
  set newNote to make new note at folder "Notes" with properties {name:noteName, body:noteHTMLText}
end tell


No need for 'Activate Last App', because is operated in the background.

You can change the font around as desired.

NOTE: In your macro above the AppleScript step is a mess, and I suspect you found it on the Net somewhere.

Never use UI-Scripting when regular AppleScript will do, and never use UI-Scripting when Keyboard Maestro will do the same thing but easier.

Keep in mind too that System Events is set auto-quit as of Mountain Lion (if memory serves), and because of this can be slow to start up on occasion. That can seriously disrupt the timing of a macro.

So if you must use System Events then do it this way:

tell application "System Events"
  if quit delay ≠ 0 then set quit delay to 0
  # <Your Code>
end tell


1 Like

Thank you. I can't get this to run on my computer as applescript. What am I doing wrong?

It worked perfectly for me, I just opened AppleScript, made a new AppleScript, pasted it in, and then ran it.

“can’t get this to run” is very vague. How exactly? Doesn’t compile? Doesn’t run? Produces an error?

Thanks a million. I retried it and it worked flawlessly without any switching around. Beautiful code.

How can I edit the code to append the highlighted text to my last created note?

Hey Mirizzi,

I don't believe it's possible to do that with AppleScript due to limitations in

However I'm looking in to some work-arounds.


Oh, for those interested in what is possible with AppleScript scope this out:


1 Like

Thanks. You are so kind.

Hi Chris,

I tried to update this script for TextWrangler, however I det an AS Compile error in line 18:
Expected ”,” but found ”””. ???


I’d like to also enter the url of the page and the current date.

[script elided -ccs]

Hey Omar,

Notes and TextWrangler are apples and oranges.

Please start a new thread with a request for a TextWrangler script, and tell me more precisely what you're wanting to do.


  • Do you have one note file?
  • Do you want multiple note files saved on disk?
  • What exactly is going to be the content?
  • You mention URLs, what will be the source of the text?


It shouldn't take long to whip one up.

Best Regards,

Can you please help modify this so that it does not have a title. In other words, can it be modified such that I see the body of the note's text in the note's title whilst using the same font as you used here?

Hey Mirizzi,

It doesn’t look like this can be done with AppleScript.

Notes is unbelievably moronic.


Just highlighting that this works for me.

I am in the middle of an exercise to extricate myself from Evernote. With it’s constant updates and rebuilding of the database, it is really annoying (yes, moreso than notes at this point).