Skip to content

Instantly share code, notes, and snippets.

@hackedunit
Created October 30, 2011 17:55
Show Gist options
  • Save hackedunit/1326190 to your computer and use it in GitHub Desktop.
Save hackedunit/1326190 to your computer and use it in GitHub Desktop.
Import a folder of text files into Apple Mail as notes
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
@elimergel
Copy link

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?

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