Last active
August 14, 2021 12:50
-
-
Save ZhuYouwei/3d828f3ef2cd4f158af7e8fef8c17313 to your computer and use it in GitHub Desktop.
Export Mac Notes to txt file
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
property outputPath : (path to desktop as text) & "export" | |
tell application "Finder" | |
if not (exists outputPath) then | |
make new folder at desktop with properties {name:"export"} | |
end if | |
end tell | |
tell application "Notes" | |
set Nf to text returned of (display dialog "Folder Name" default answer "Notes") | |
if not (exists folder Nf in account "iCloud") then | |
display dialog "No such Folder" | |
error number -128 | |
end if | |
repeat with aNote in notes in folder Nf in account "iCloud" | |
set Ntitle to name of aNote | |
set NContent to plaintext of aNote | |
tell application "TextEdit" | |
set thisDoc to make new document with properties {name:(Ntitle & ".txt"), text:NContent} | |
close thisDoc saving in POSIX file (POSIX path of (outputPath) & "/" & (name of thisDoc)) | |
end tell | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment