Created
October 2, 2016 16:44
-
-
Save jonasbits/69018b584d678752080bc4c40ee0c4da to your computer and use it in GitHub Desktop.
Export Apple Notes via AppleScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "TextEdit" | |
activate | |
make new document | |
end tell | |
tell application "Notes" | |
if folder "Archive" exists then | |
set output to "" | |
repeat with aNote in notes in folder "Archive" | |
set noteText to "<!-- ### Start Note ### -->\n" | |
set noteText to noteText & ("<h1>" & name of aNote as string) & "</h1>\n" | |
set noteText to noteText & ("<p>Creation Date: " & creation date of aNote as string) & "</p>\n" | |
set noteText to noteText & ("<p>Modification Date: " & modification date of aNote as string) & "</p>\n" | |
set noteText to (noteText & body of aNote as string) & "\n\n" | |
tell application "TextEdit" | |
activate | |
set oldText to text of document 1 | |
set text of document 1 to oldText & noteText | |
end tell | |
end repeat | |
else | |
display dialog "Aww!" | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
folder needed to be "Notes" to work