Automatically export .docx documents to PDF using Pages

Automatically export .docx documents to PDF using Pages

I often receive emails with attachments in .docx format. The Pages app on Mac is capable of editing and saving these documents, but if I don’t need to edit a document I prefer to save these documents as PDFs, which makes it easier to open them anywhere (mobile, different computers, etc…).

If you get a lot of emails with .docx attahcments, this can become time consuming and repetitive. I’ve designed the following AppleScript to automatically convert .docx documents to PDF using Pages:

I use this script in conjunction with a Hazel rule on my ‘inbox’ folders (organized by email of sender), with the documents being saved to those folders by another AppleScript which runs in an mail.app rule.

The Hazel rule looks like this: Docx converter

The ‘embedded script’ in the AppleScript is the gist attached above.