Skip to content

Instantly share code, notes, and snippets.

@able8
Created May 16, 2017 08:34
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save able8/0a7ac85ebb3f77b7b427288621551b86 to your computer and use it in GitHub Desktop.
Save able8/0a7ac85ebb3f77b7b427288621551b86 to your computer and use it in GitHub Desktop.
Export Apple Notes via AppleScript
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
@1049451037
Copy link

not working...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment