09/30/12 18:54:55

Save All Your iTunes/Mail Receipts as PDF

For various reasons I wanted to print my iTunes receipts as PDF. Automated, of course, since I needed all of them fom 2011 until now.
Of course Keyboard Maestro was a big help here. I stumbled over Nerd Gap’s post and based my macro off of his.

Smart Mailbox

First we need a smart mailbox that displays all iTunes receipts.

Select one of the mails and add a create a new smart mailbox. Give it some details to find all of the receipts. In my case all emails happen to have a similar subject and sender name.

iTunes Invoices Smart Mailbox

Keyboard Maestro Macro

Building the macro is a bit more trick because I have the option “display remote images in HTML” off in Mail.app. That’s why I’m using a click action to click the “Load Images” button before initiating the print process.
All the window animations take some time to complete, so I’m using Pause quite extensively. The macro saves the PDF’s directly on the Desktop (⌘D, ⌘S).
A double-⌘P prints as PDF. (Set in Application Shortcuts under Keyboard). You can also add an alias to your Desktop under ~/Library/PDF Services — which can have its own shortcut.

Keyboard Maestro action with repeat

You can further automate the process by wrapping the entire macro in a Repeat action. Just make sure the list with the receipts is highlighted (the message has a blue background), otherwise “down arrow” will cause problems. I’d recommend trying this with a repeat of 2 or 3 first!

Then activate the macro and get a cup of your favorite tea.

On the plus side, with a macro like this, you can save every email (that is also supposed to be a receipt) as PDF, so that you can mail it to your accountant.