I saw a Tweet from Scott Paterson, asking if there was an AppleScript to quickly batch export Notes from Apple Mail into individual text file.
Well Scott — If there wasn’t one before, there is now!
Features
- This AppleScript will export any selected Messages or Notes in Apple Mail as individual text files to a temporary folder on your Desktop (called “Temp Export Folder”);
- The script also attempts to remove any “illegal characters” from the file name as to avoid the process grinding to a complete halt!
- If you have Growl installed, the script should detect it and notify you when your export is completed.
Current Limitations and Open Issues
(Otherwise known as “Places Where You Could Help Out!”)
- I kept the output very basic — only spitting out the content of the note/message as the content of the text file. It *IS* possible to add more information from the messages and, if people are interested in that, let me know!
- Errors that will undoubtedly arise when you do something that I didn’t think of or test for! 😉
How to Install and Use
As of Version 1.1, the source code and instructions are moving to the Veritrope.com Code Library:
CLICK HERE TO GET THE SCRIPT AND SEE THE SOURCE CODE!
Twitter Comment
Thanks to @veritrope for knocking up AppleScript to export Notes to text files from Mail.app [link to post]
– Posted using Chat Catcher
Thanks for putting this together. Two things: 1) Can I have the original dates exported with the notes? 2) The script fails because it requires Growl which I don’t have installed (I don’t really have a need for Growl). Do you have a version of the script that doesn’t need Growl?
The Growl issue must be a bug — it’s supposed to detect whether or not you have it installed and adjust. Click here to file a bug report so that I don’t lose track of it and, when I’m working on a new revision, I’ll spend some time on this!
A question: How would you want the original dates presented? As a header at the top of the note?
for me, it would be useful to have basic messages headers placed at the top of each txt file. would love to see at least “From:”, “Subject:”, and “Date:”. would that be easy to add if i knew what i was doing?
(i am about to take off on a big trip, am trying to create an archive of the relevant mail folder, don’t really have time to delve into learning applescript just now.)
It wouldn’t be that hard, but I am in the middle of a big trip myself right now, so I’m not sure when I’d be able to add it. Check back here or subscribe to the Twitter feed for updates and I’ll post a notice when I revise it!
You just saved me about an hour. Thank you.
Thanks !! Perfect for converting email to text so that the new (Dragon ) Dictate can learn writing style / vocab!! This saved me TONS of time / training…
Thank you again!!
EricB
Thanks — and I think that’s a really great way to use this script!
I’d love to use it the same way myself and I even reached out a few weeks ago to Dragon to send me a review copy so I could also try some direct scripting… Guess I’ll have to wait for them to offer that promised crossgrade from the PC version! 😉
One way or another, I think I’ll have some Dragon scripts up sometime in the near future…. and if you come up with any of your own, please use the submission page to share them with all of us!
Thank you! Thank you! This is exactly what I needed!
This was a very helpful tool, thanks! On my Mac running 10.5.8, I commented out the 32-character filename limit, removed the illegal character filter (except “:”), and removed the “.txt” filename suffix. Then I was able to use it to export 600 Notes from Apple Mail to the temp folder, then import everything in that temp folder to my Mark/Space Notebook then synchronize them into the Fliq notebook app on my Samsung Galaxy S Captivate (Android 2.1) using The Missing Sync for Android. Whew!
It would be nice to have parameters at the top of the the script to choose the file naming validation based on the operating system.
That’s an interesting idea, Kevin… let me play around with some ways to do that!
Hi Justin,
This certainly is a timesaver.
One problem I encountered: whenever two messages have the same name, the first is written over by the second. So I took a deep breath and changed the a little, by adding a counter, that is attached to the filename:
...
repeat etc.
....
set theFilePath to (SaveLoc & msgnr & "_" & theFileName & ".txt")
set msgnr to msgnr+1
end repeat
etc.
Hans Erik
Hans Erik,
Thank you so much for your contribution to the script — I’ve added it to the source code which is now hosted in the Veritrope.com Code Library!
This little script saved my bacon. Man, I think it’s crazy that Apple doesn’t have an “export messages” button under their Mail/File menu.
Mmmm… BACON!
😉
Seriously though — Glad it was of help to you, Rick!
why do you have to prefix the text files with number and underscore?????
nevermind.. i’ve removed your portion of code that adds the prefix.
Being able to tweak this stuff to your preference is one of my favorite things about AppleScript — glad you sorted it out! 😀