OS X ML Notes App Script Help

Hi

I’m looking for a script that searches by Note Title (First Line) and then shows the body of the note.
however, everytime I try this I get an error as shown in the print screen.

My Code is:


tell application "Notes"
	
	exists "NOTE NAME "
	body of "NOTE NAME "
	
end tell

Any help would be great
Thanks in Advance
James

Hi,

you forgot the class identifier


tell application "Notes"
	if exists note "NOTE NAME " then
		get body of note "NOTE NAME "
	end if
end tell

hi, many thanks for your quick response, i was wondering if you can help me again?
say i have a note called “Shopping List” and then i have many items in this list, each on a new line. how would i code something that looks at the list, and then outputs the list.

so in the notes app

Shopping List
apple
oranges
pears

outputs in apple script
apple
oranges
pears

as i am then going to use this output somewhere else

many thanks again
james

the body of the note is html formatted, so you have strip the html tags


tell application "Notes"
	set noteBody to body of note "Shopping List"
end tell
set textSource to do shell script "echo " & quoted form of noteBody & " | textutil -stdin -stdout -format html -convert txt -inputencoding UTF-8"
display dialog textSource buttons {"Cancel", "OK"} default button "OK"


Edit: Or with stripping the headline


tell application "Notes"
	set a to body of note "Shopping List"
end tell
set textSourceLines to paragraphs of (do shell script "echo " & quoted form of a & " | textutil -stdin -stdout -format html -convert txt -inputencoding UTF-8")
set {TID, text item delimiters} to {text item delimiters, return}
tell textSourceLines to set textSource to items 2 thru -1 as text
set text item delimiters to TID

display dialog textSource buttons {"Cancel", "OK"} default button "OK"