Skip to content

Instantly share code, notes, and snippets.

@jamesstout
Created August 10, 2013 14:49
Show Gist options
  • Save jamesstout/6200704 to your computer and use it in GitHub Desktop.
Save jamesstout/6200704 to your computer and use it in GitHub Desktop.
tell application "Notes"
activate
delay 0.1
end tell
try
tell application "Notes" to get note "geeknotes"
on error
set output to "No current note called geeknotes"
end try
-- now you have one note which has:
-- body
-- name
-- other properties
-- did you want to iterate through the lines of the note?
-- or maybe you have a folder called geeknotes?
try
tell application "Notes" to get folder "geeknotes"
tell application "Notes"
set notelist to every note of result
end tell
repeat with i from 1 to number of items in notelist
set this_note to item i of notelist
-- again, you now hoave one note with the same properties I mentioned earlier.
end repeat
-- if you just wanted to count the notes
-- skip the repeat above and
set output to number of items in notelist
on error
set output to "No current folder called geeknotes"
end try
-- use AppleScript Editor to see what properties a folder has
-- there will be a list of notes to iterate through.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment