One of the many, many things I love about OSX is the ability to automate the OS and many of its applications. Until Yosemite this was done either through Automator, a simple, ingenious, but ultimately limited drag and drop app, and AppleScript a weird, readable, but unfathomable scripting language.

AppleScript lets you write statements like;

 tell application "Mail"

AppleScript readable. You instantly understand that the most of what is happening. No coding understanding needed. The problem comes when you try to write something. You can't just write what you want to happen. You have to know the correct verbs. You have to structure the sentence in the correct way. Human language is fuzzy. Code is not, it is precise, concise, and abstract. That's why most code is not readable to people who do not bring with them and understanding of coding. Applescript despite it's readability is not friendly to non-coders or coders.

OSX Yosemite changed all that. It brought support for JavaScript Automation. JavaScript is a C like language, commonly used to do lovely things to webpages. It's has many flaws, but it is precise and concise. The two lines above in JavaScript for Automation would read;

var mail = Application('Mail');

Less understandable. Less human, but I love it and I am already making use of it. I have a form on a website that, when filled in pings me an email with the form contents. The email looks like this;

Name: Joe Bloggs
Email Address:
I am...: a made up person
Post Code: E17
Twitter: @nope
Instagram: nope

I have 130 of these email messages sat in a folder. The client who requested the form sends me an email asking for the details in a spreadsheet. Manually this would be a boring job. With a little automation this is a few clicks. I select the messages I want to put into the sheet, and run the script. Ten seconds later, I have a new spreadsheet. The best thing is, this script can be quickly changed to deal with any set of structured emails.

So, if you have an some understanding of coding, a Mac and a little time, I suggest you give it a try. You can find the script I've been talking about above here. Please feel free to take it, alter it and make it better. Take a look and have fun.

AuthorJunction Seven