Created
August 1, 2019 15:30
-
-
Save tkalus/3d2eb50c2eb0b841ce45c3a4c7337c3c to your computer and use it in GitHub Desktop.
Export an entire Folder in Apple Notes to a single text file via TextEdit
This file contains hidden or 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 "Stuff" exists then | |
set output to "" | |
repeat with aNote in notes in folder "Stuff" | |
set rawText to "----------\n" | |
set rawText to rawText & (name of aNote as string) & "\n" | |
set rawText to rawText & "----------\n" | |
set rawText to rawText & (name of aNote as string) & "\n" | |
set rawText to rawText & (body of aNote as string) & "\n\n" | |
set inTag to false | |
set scrubbedText to "" | |
repeat with i from 1 to length of rawText | |
set rawChar to character i of rawText | |
if rawChar is "<" then | |
set inTag to true | |
else if rawChar is ">" then | |
set inTag to false | |
else if inTag is false then | |
set scrubbedText to scrubbedText & rawChar as string | |
end if | |
end repeat | |
tell application "TextEdit" | |
activate | |
set oldText to text of document 1 | |
set text of document 1 to oldText & scrubbedText | |
end tell | |
end repeat | |
else | |
display dialog "Nope. No folder..." | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment