mail

Ubiquitious Mac Automation

I often find myself wanting to make my Mac do something even when I’m not there. It could be something as simple as “reboot” or something more complex, like, “Add this task to OmniFocus”. Unfortunately, unless my Mac is up and running and accepting remote connections, there’s no way I can do this.

Or is there?

One obvious answer is to set up mail rules that shoot off AppleScripts. When an appropriately formatted messages comes in from the right sender(s), the script runs, and you’re all set to go. This approach has the advantage of being either close to real time (if Mail’s up and running, it works) or asynchronous if Mail’s off — the actions will fire off when you next check email, if your computer happens to be off.

Another option is to monitor various internet feeds to create similar results. I’ve written about Proxi before, and it remains one of my favorite tools for automating my Mac. One thing it can do is monitor network resources, such as RSS feeds, Twitter accounts, Mail, Skype, iChat, etc. This, it turns out, is the key to handling this need for remote automation.

By monitoring an RSS feed, you can set it up to check Gmail (which publishes an ATOM feed of your mail), a blog, or anything else, and have it fire off a script with some or all of the values passed by the feed. One very cool use of this ability is to set up script-firing Gmail rules by just having Proxi parse the ATOM feed and then activate scripts when certain conditions are met. This gives you the best of both worlds: Gmail’s powerful web-based interface, and the integrated goodness of Apple’s Mail program.

Another great tool is Twitter. Twitter’s main purpose is to share little snippets about what you’re up to with the rest of the world. But Twitter can also be used as simply an online notepad. It integrates with both SMS and IM clients, so it’s easy to contact, and you can even use a service like Jott with it, so you can phone in a “tweet” to your Twitter account.

Proxi has a Twitter monitor, so if you set up an appropriate Twitter account, you can have Proxi take action on incoming tweets, just like it can with GMail’s RSS feed.

Lastly, Proxi can monitor iChat and Skype and fire off scripts based on behavior in those apps. (iChat also has some of these capabilities built in if you’ve upgraded to Leopard) This can be an excellent way to have instant access to your computer from a remote machine.

What have I done with this? Well, I set up a Twitter account that feeds directly into OmniFocus so that I can capture a new task anywhere (via the web, SMS, IM, or the phone — thanks to Jott) and rest assured that when I next turn on my Mac, Proxi will pick them up and dump them into my electronic inbox.

Fed up...

The title says it all. I’m fed up!

I’ve been AppleScripting things for many years now, and I’ve come to expect some pretty idiosyncratic behavior from AppleScript. Sure, there’s the occasional application that won’t take “whose” or “which” and insists on “where its” instead; or the method that mixes up “true” and “having”; that’s part and parcel of the AppleScript English-like syntax.

But it’s gotten worse.

See, I’ve been trying to script Apple’s Mail application. And, well, it’s pretty damn near impossible to do.

Why? Well, because it’s broken, that’s why. Create an outgoing message, and it has no identifier! Try to classify an incoming message via a rule? Well, it doesn’t have an ID, either.

Problems with Mail to KGTD

A number of users have reported that when their mail rules activate Mail to KGTD, they get an error type 8. I’ve tracked down the CAUSE of this problem, but I’m not quite at a solution yet.

The cause is that when messages come in, they don’t seem to have message IDs anymore. Since my script requests a message ID, everything borks when it tries to get it. Once messages are properly received (after rules are run), they have IDs (like they should), which is why Mail Act-On continues to work, as will the rule if you edit it and then request that the new rule run on all messages in your inbox.

Search for Mail Thread

This handy script takes a selected message in Apple’s Mail application and does a spotlight search for other messages with the same subject heading. It’s an easy way to find every related message, even if they’re scattered out among multiple folders (e.g. Sent, Trash, and the Inbox).

Syndicate content