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

Scripting Pages (new twist)

I've been successfully using an Applescript that uses Pages (and other iWork apps) to convert files to PDF format (e.g., for Word documents it opens Pages, opens the Word document and then does a Save As specifying PDF format, essentially exporting the file).


In a recent update of Pages has kinda ruined this script. Occasionally I will open a file that will create the document review warnings panel ("Some warnings have occurred. Would you like to review them now?". In the past this hasn't mattered, but now it hangs Pages and the scripting engine and I have to Force Quit it). I, of course, don't know which files will trigger this apriori.


I'm certainly no Applescript expert, but I've combed the net and the script dictionary for Pages and can't find something that can detect if this dialog pops up and essentially ignore it (i.e., "Don't Review").


Is there some magic option in Pages or Applescript that I can employ to once again make this script useful? (Alternatively, anyone have a way of generating PDFs from Word documents without purchasing MS-Office?)


Thanks very much,


- dave


OS X: 10.7.4, Pages '09 V4.2 (1008)

Posted on Sep 9, 2012 11:41 AM

Reply
5 replies

Sep 10, 2012 11:17 AM in response to davebets

I'm not sure how you are going about this, and since I am running Pages 4.1 on Snow Leopard, I don't get the dialog box that is causing your problem. I just tried a version of the script that will follow with some additional lines to call an Open dialog between opening the file and saving it, and it saved anyway leaving the dialog open in front. Maybe something in this would help you.


I put a file test.doc on the desktop (it did create a document warning about a substitution, but I don't get the dialog). I then ran the following script:


set x to alias ((path to desktop as text) & "test.doc")

set y to (path to desktop as text) & "test.pdf"

tell application "Pages"


openx

set theDocument to front document

save theDocument as "SLDocumentTypePDF" in y

end tell


It saved the PDF file, even with the "Open…" dialog in front.

Scripting Pages (new twist)

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