I have a script to create new notes in the Notes app, and I’m wanting to format the title/first line. I’ve tried a few things but am struggling with it.
Here’s the script:
set noteTitle to "Test Note 1"
set noteBody to "Blah, blah, blah"
tell application "Notes"
activate
tell account "iCloud"
tell folder "Notes"
make new note with properties {name:noteTitle, body:noteBody}
end tell
end tell
end tell
I have ‘New notes start with: Title’ checked in Notes’ Preferences, but that doesn’t seem to affect notes created with AppleScript.
I don’t want to change any of the text (title or body) with a different font or anything. All I want to do is format the first line as title (as though I’ve highlighted the first line and then selected ‘Format > Title’ from the menu bar (or toolbar)".
set noteBody to "<body><h1 style=”color:white;”>Test Note 1</h1>
<p style=”color:red;” >Blah, blah, blah</p>
</body>"
tell application "Notes"
activate
tell default account to tell folder "Notes"
make new note with properties {name:" ", body:noteBody}
end tell
end tell
Yes, you are right, Nigel. Update script above (to get correct color’s behavior):
set noteBody to "<body><h1 style=\"color:green;\">Test Note 1</h1>
<p style=\"color:red;\" >Blah, blah, blah</p>
</body>"
tell application "Notes"
activate
tell default account to tell folder "Notes"
make new note with properties {name:" ", body:noteBody}
end tell
end tell