Created
October 30, 2011 17:55
-
-
Save hackedunit/1326190 to your computer and use it in GitHub Desktop.
Import a folder of text files into Apple Mail as notes
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 "Finder" | |
activate | |
set the source_folder to choose folder | |
set note_files to (every file in source_folder) as alias list | |
end tell | |
repeat with i from 1 to number of items in note_files | |
try | |
open for access item i of note_files | |
set txt to read item i of note_files | |
close access item i of note_files | |
set the clipboard to txt | |
tell application "Mail" | |
activate | |
end tell | |
tell application "System Events" | |
tell process "Mail" | |
click the menu item "New Note" of the menu "File" of menu bar 1 | |
click the menu item "Paste and Match Style" of the menu "Edit" of menu bar 1 | |
click the menu item "Close" of the menu "File" of menu bar 1 | |
end tell | |
end tell | |
on error errMsg | |
display dialog "Error on file " & i & " - " & errMsg | |
end try | |
end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have been trying to get this to work with the newly released notes app. But It keeps freezing, is there a command to make it wait?