Need to automate a weekly task using AppleScript
March 28, 2009 8:20 PM Subscribe
I need to automate the process of printing a report to PDF with the date in the file name, saving it in an archive folder, printing it, and emailing it as an attachment. I am on a Mac and using Pages, Automator, and AppleScript. Help me find the missing pieces!
posted by joshrholloway to computers & internet (4 answers total) 2 users marked this as a favorite
I have to write a report each Friday for work and send it as an attachment to a specific email address where it gets processed by an internal server. Usually my process is as follows:
1. Write report in Pages.
2. Print report as PDF to a specific folder using OS X's built-in capabilities.
3. Name the PDF file based on the date.
4. Print the PDF file to a hard copy.
5. Attach the PDF to an email using Mail and send it.
I realize that's not a ton of work, but this Friday I felt the urge to automate the process. At first I wanted to do it to save myself some time, and then once I had spent an hour trying to figure it out it became more of a challenge, and then after spending another hour on it I didn't care about solving the problem myself and just wanted a solution by any means necessary.
Most of the individual pieces of this automated task are not difficult to accomplish, but I have found it difficult to get each step to talk to the next. I have also had trouble due to the fact that I want to make the file name of the saved PDF contain the date it was saved. I'm sure this would be easy for anyone who has used AppleScript extensively, but I'm just a beginner at it so it's baffling me.
Could someone help me figure out the proper script structure to make all this work? If it matters, I am using the latest version of OS X and Pages. The files need to be saved with the name "weekly_report_MM_DD_YYYY.pdf" (it doesn't have to be exact, just something along those lines) and the email that it is attached to doesn't need anything in it except for a recipient. If I've forgotten any necessary details, please let me know and I'll provide them.