AppleScript to Print from Numbers to PDF

I want to use Applescript to automatically save an invoice worksheet to a folder with the invoice number as the file name.

The invoice number is an auto generated number. For the sake of this lets say its in cell A1 of Table 1 on Sheet 1.


This is what I have been able to find so far. Does not work as intended and also unable to figure out how to set the file name or location.




tell application "System Events"

tell process "Numbers"

keystroke "p" using command down

tell sheet 1 of window 1

click menu button "PDF"

repeat until exists menu 1 of menu button "PDF"

delay 0.02

end repeat

click menu item "Save as PDF…" of menu 1 of menu button "PDF"

end tell

end tell

end tell

Any help is greatly appreciated.

Numbers-OTHER

Posted on Jun 19, 2016 11:50 AM

Reply
1 reply

Jun 19, 2016 3:53 PM in response to psionica

Can't help you directly, but you may find this information useful:

User uploaded file

Note that the print dialogue is a drop down from the Script Editor window and shows the Script Editor 'page' in it's Preview window.

The Events log reports the error that stopped the script and shows the last line attempted in its window.

To view the Events report, click the 'page' icon at the bottom of the script editor window. (Marked by the V in the 'augmented' script below), then the Events button in the row above the report pane (darkened and peeking out from just below the Print dialogue in the image above).

User uploaded file

Regards,

Barry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

AppleScript to Print from Numbers to PDF

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