0

I have tested this Notes export script (https://github.com/alexwlchan/notes-export/blob/master/notes-export.scpt). It seems to work, but the issue is that I want to specify a specific Notes folder to export, rather than every single one.

The issue is the main loop clause:

repeat with theNote in notes

"notes" is a Notes field that is a collection of all notes. However, I only want notes in a specific Notes directory. I have no problem specifying the Notes folder by name and having the script confirm that the folder actually exists. Unfortunately, I don't see this documented anywhere.

How do I, in AppleScript, get the list of notes in a specific Note folder? I also need to get the notes's path, since in some cases the Notes directories I am exporting in turn have sub-directories.

1 Answer 1

1

Try:

tell application "Notes"
    set myFolder to first folder whose name = "FolderA"
    set myNotes to notes of myFolder
    repeat with theNote in myNotes
        -- insert your code here
    end repeat
end tell
3
  • Can you please add some explanations documenting the actions the code performs?
    – IconDaemon
    Commented Feb 2, 2016 at 12:24
  • AppleScript reads like pseudo script anyway but... this script processes the notes within a folder named "FolderA". If the user replaces "FolderA" with the name of the directory he/she wants to use, it will process each note assigned to the theNote variable.
    – adayzdone
    Commented Feb 2, 2016 at 14:19
  • Thanks. I also want to preserve the directory structure when I export notes from "FolderA", which has subdirectories. Is it possible to also get the path of each note inside of "FolderA"? Commented Feb 2, 2016 at 16:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .