Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Convert multiple text files to Mail notes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Convert multiple text files to Mail notes
Authored by: paczor on Jul 30, '12 09:50:55AM
I used this script on Snow Leopard 10.6.8 and have some problems. First of all OSX didn't allowed me to run "click the menu item" lines in Applescript part of code until I've enabled access for assistive devices. To enable it run "System Preferences", then "Universal Access" and check "Enable access of assistive devices" on the bottom.
Another problem was with assigning Applescript part as "cmd" variable. I have no time to find out why so I moved lines:
       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" of the menu "Edit" of menu bar 1
		end tell
	end tell 
to separate Applescript file (I opened Applescript Editor, pasted above lines and saved it in my homedir as make_note.scpt).

Then I've changed very last line of Python code: instead of
os.system(cmd)
I used:
os.system("osascript /Users/paczor/make_note.scpt")
It worked very well.

If one will run this script he will end up with many notes windows opened, I had 88 notes so have to close them all. ;) If bother add following line:
click the menu item "Close" of the menu "File" of menu bar 1
after this line:
click the menu item "Paste" of the menu "Edit" of menu bar 1


[ Reply to This | # ]