Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Mail merge a numbers document using applescript

I am totally new to Applescript so I have no idea what the limitations are. I am trying to write an applescript that will open a template then open mail merge pick a Numbers document named "new bid" and run the mail merge for me. Is this possible? So far I am able to get the template to open using the following script


tell application "Finder"


activate


open document file "Proposal.template" of folder "My Templates" of folder "Templates" of folder "Pages" of folder "iWork" of folder "Application Support" of folder "Library" of folder "myname" of folder "Users" of startup disk


end tell

Pages 09-OTHER, Mac OS X (10.7.3)

Posted on Feb 8, 2012 9:19 PM

Reply
2 replies

Feb 9, 2012 6:57 PM in response to Jonshutz

To clarify....I have a numbers document that I use to generate the numbers and information I need to create a proposal. I have a template set up in Pages 09 that I need to fill in the blanks. I can open Pages and run the mail merge manually and it works great. I was hoping I could run a script that would run as soon as I save the numbers file as "new bid" that would open Pages click edit, click mail merge, select the "new bid" numbers document as the souce and run the mail merge. If I could also get it to save the document as a PDF that would be awesome.


Thank you....Jon

Feb 19, 2012 5:15 AM in response to Jonshutz

Jon,


Since no one else has been responding, I'll chime in with a few thoughts here.


I think this could be an interesting project for you, if you like that sort of thing. It might be a little over-ambitious for a first AppleScript project, though. The biggest problem is that Pages doesn't have any AppleScript "hooks" for working with mail merge, so it will have to be done with GUI scripting (System Events). If you search Yvan Koenig's posts, you can find a lot of excellent examples for scripting iWork, many of which use GUI scripting.


I would suspect that it would be difficult to script the selection of the Numbers document as the source for the mail merge, but if the Numbers document doesn't change, and you run the mail merge manually before you create the final Pages template, I think the default Numbers document can be stored in the template.


For portability reasons, I like to work with (a copy of) the template stored in the script bundle, but that probably isn't awfully important here.


A useful reference for saving the document to pdf can be found at http://hints.macworld.com/article.php?story=20100206104340866.


Jeff

Mail merge a numbers document using applescript

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.