Doing some research what is possible in Notes, its in early state. (I will update)
(**
* Paragraph styles of the body property in Notes.
**
* set theTitle to "<div><h1>Title</h1></div>"
* set theHeading to "<div><h2>Heading</h2></div>"
* set theSubheading to "<div><h3>Subheading</h3></div>"
* set theBody to "<div>Body</div>"
* set theMonospaced to "<div><tt>Monospaced</tt></div>"
*
* set theBulletedList to "<ul>
* <li>Bulletet list</li>
* </ul>"
*
* set theSpace to "<div><br></div>"
*
* set theDashedList to "<ul class=\"Apple-dash-list\">
* <li>Dashed list</li>
* </ul>"
*
* set theNumberedList to "<ol>
* <li>Numbered list</li>
* </ol>"
*
*)
-- Make a new body text with title and body.
-- its makeNoteInFolder:"MyNotes" itsTitle:"Title" itsBody:"Body"
-- Make a new body text with title and bullered list.
its makeNoteInFolder:"MyNotes" itsTitle:"Bulleted list" itsBulletedLists:{"bulletedString 1", "bulletedString 2"}
-- return its getAllBodyAndPlainTextInFolder:"MyNotes" noteNames:(its getAllNamesInFolder("MyNotes")) targetName:"Bulleted list"
on makeNoteInFolder:folderName itsTitle:titleString itsBulletedLists:bulletedStrings
set titleString to "<div><h1>" & titleString & "</h1></div>"
set returnString to ""
repeat with anItem in bulletedStrings
set bulletedListString to "<ul>
<li>" & (contents of anItem) & "</li>
</ul>"
set returnString to returnString & bulletedListString & linefeed
end repeat
set bulletedListString to returnString
set theBody to titleString & bulletedListString
tell application "Notes"
tell folder folderName
make new note at end with properties {body:theBody}
end tell
end tell
end makeNoteInFolder:itsTitle:itsBulletedLists:
(**
* [makeNoteInFolder:string folderName itsTitle:string titleName]
* Make a new note with title and body (Paragrah Styled)
*)
on makeNoteInFolder:folderName itsTitle:titleString itsBody:bodyString
set titleString to "<div><h1>" & titleString & "</h1></div>"
set bodyString to "<div>" & bodyString & "</div>"
set theBody to titleString & bodyString
tell application "Notes"
tell folder folderName
make new note at end with properties {body:theBody}
end tell
end tell
end makeNoteInFolder:itsTitle:itsBody:
(**
* [getAllBodyAndPlainTextInFolder:string folderName noteNames:list noteNames targetName:string targetName)]
* Get the body and plain text of note
*)
on getAllBodyAndPlainTextInFolder:folderName noteNames:noteNames targetName:targetName
tell application "Notes"
tell folder folderName
try
if targetName is in noteNames then
return {|plainText|:its plaintext of note targetName, bodyText:its body of note targetName}
else
display alert "Error: The note name \"" & targetName & "\" do not exists."
end if
end try
end tell
end tell
end getAllBodyAndPlainTextInFolder:noteNames:targetName:
(**
* [getAllNamesInFolder(string folderName)]
* Get the names of note
*)
on getAllNamesInFolder(folderName)
tell application "Notes"
tell folder folderName
return (its name of note)
end tell
end tell
end getAllNamesInFolder
This script include some more tests.
(**
* Paragraph styles of the body property in Notes.
**
* set theTitle to "<div><h1>Title</h1></div>"
* set theHeading to "<div><h2>Heading</h2></div>"
* set theSubheading to "<div><h3>Subheading</h3></div>"
* set theBody to "<div>Body</div>"
* set theMonospaced to "<div><tt>Monospaced</tt></div>"
***
* set theBulletedList to "<ul><li>Bulletet list</li></ul>"
* set theLineBreak to "<div><br></div>"
* set theDashedList to "<ul class=\"Apple-dash-list\"><li>Dashed list</li></ul>"
* set theNumberedList to "<ol><li>Numbered list</li></ol>"
***
* set theBold to "<div><b>Bold font style</b></div>"
* set theItalic to "<div><i>Italic font style</i></div>"
* set theUnderline to "<div><u>Underline font style</u></div>"
* set theStrikethrough to "<div><strike>Strikethrough font style</strike></div>"
***
* set theFontColor to "<div><font color=\"#FF2600\">FontColorText</font></div>"
* set theFontColor "<span style='color: red; font-style: oblique;'>FontColorText</span>"
*)
-- Make a new body text with title and body.
-- its makeNoteInFolder:"MyNotes" itsTitle:"Title" itsBody:"Body" lineBreakAtEnd:true
(*
-- Example of using GUI scripting to make checklist
set checkList to {"CheckPoint 1", "CheckPoint 2", "CheckPoint 3"}
repeat with i from 1 to count checkList
(its clickMenuItem:"Checklist" inMenuBarItem:"Format")
its typeMessage(item i of checkList)
end repeat
*)
-- Make a new body text with title and bulleted list.
-- its makeNoteInFolder:"MyNotes" itsTitle:"Bulleted list" itsBulletedLists:{"bulletedString 1", "bulletedString 2"}
return its getAllBodyAndPlainTextInFolder:"MyNotes" noteNames:(its getAllNotesNamesInFolder("MyNotes")) targetName:"Bulleted list"
on makeNoteInFolder:folderName itsTitle:titleString itsBulletedLists:bulletedStrings
set titleString to "<div><h1>" & titleString & "</h1></div>"
set returnString to ""
repeat with anItem in bulletedStrings
set bulletedListString to "<ul>
<li>" & (contents of anItem) & "</li>
</ul>"
set returnString to returnString & bulletedListString & linefeed
end repeat
-- Set linebreak or space between paragraph.
set theLineBreak to "<div><br></div>"
(*
-- Examples to set a color style and font-style. (ps. still do testing...)
set theColoredText to "<span style='color: green; font-style: oblique;'>"
set theColoredTextEndTag to "</span>"
*)
set bulletedListString to returnString
-- Test Title & BulletedList
-- set theBody to titleString & bulletedListString
-- set theBody to titleString & bulletedListString & theLineBreak
-- The 'theColoredTextEndTag' doesn't do anything... still investigate.
-- set theBody to titleString & theColoredText & bulletedListString & theLineBreak & theColoredTextEndTag
tell application "Notes"
tell folder folderName
make new note at end with properties {body:theBody}
end tell
end tell
end makeNoteInFolder:itsTitle:itsBulletedLists:
(**
* [makeNoteInFolder:string folderName itsTitle:string titleString itsBody:string bodyString lineBreakAtEnd:boolean]
* Make a new note with title and body (Paragrah Styled)
*)
on makeNoteInFolder:folderName itsTitle:titleString itsBody:bodyString lineBreakAtEnd:lineBreakAtEnd
set titleString to "<div><h1>" & titleString & "</h1></div>"
set bodyString to "<div>" & bodyString & "</div>"
set theLineBreak to "<div><br></div>"
if lineBreakAtEnd is true then
set theBody to titleString & bodyString & theLineBreak
else
set theBody to titleString & bodyString
end if
tell application "Notes"
tell folder folderName
make new note at end with properties {body:theBody}
end tell
end tell
end makeNoteInFolder:itsTitle:itsBody:lineBreakAtEnd:
(**
* [getAllBodyAndPlainTextInFolder:string folderName noteNames:list noteNames targetName:string targetName)]
* Get the body and plain text of note
*)
on getAllBodyAndPlainTextInFolder:folderName noteNames:noteNames targetName:targetName
tell application "Notes"
tell folder folderName
try
if targetName is in noteNames then
return {|plainText|:its plaintext of note targetName, bodyText:its body of note targetName}
else
display alert "Error: The note name \"" & targetName & "\" do not exists."
end if
end try
end tell
end tell
end getAllBodyAndPlainTextInFolder:noteNames:targetName:
(**
* [getAllNotesNamesInFolder(string folderName)]
* Get the names of note
*)
on getAllNotesNamesInFolder(folderName)
tell application "Notes"
tell folder folderName
return (its name of note)
end tell
end tell
end getAllNotesNamesInFolder
(*** GUI Scripting ***)
on clickMenuItem:menuItem inMenuBarItem:menuBarItem
tell application "System Events" to tell process "Notes"
set frontmost to true
tell menu bar 1 --
tell menu bar item menuBarItem
click (menu item menuItem of menu 1)
end tell
end tell
end tell
end clickMenuItem:inMenuBarItem:
on typeMessage(messageString)
tell application "System Events" to tell process "Notes"
set frontmost to true
keystroke messageString
keystroke return
keystroke return
end tell
end typeMessage