| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Here is my version of a Word to PDF script: Here are points points to consider: 1/ If you use the built-in print-to-PDF feature of Mac OS X for an MS Word document with multiple sections, you will get multiple PDFs, one per section. Preview will generate a single PDF file with the correct page layouts. And that does the trick as Preview's GUI can be scripted! So my script has two sections: the first one, in Word, that gets the document and the file's name and then calls Preview; the second one, in Preview, that formats the pdf document and saves it. 2/ You need to include delays long enough for the script to keep up with the pace (machine's speed and document's size) - or the script will crash, so experiment with changing the delays to a comfortable level - YMMV. 3/ The script is obviously dependent on the versions of OS X, Microsoft Word and Preview. And here is the script: tell application "Microsoft Word" to activate tell application "System Events" tell application process "Microsoft Word" click menu item "Print..." of menu "File" of menu bar item "File" of menu bar 1 delay 0.5 click button 4 of UI element 5 of window 1 end tell end tell -- delay 1 -- tell application "Preview" to activate tell application "System Events" tell application process "Preview" click menu item "Print…" of menu 1 of menu bar item "File" of menu bar 1 delay 0.5 click at position of UI element 1 of UI element 6 of UI element 4 of sheet 1 of window 1 delay 0.2 key code {125, 49} delay 1 -- if new file name is needed, enter the pdf name into the Save dialog's text field set value of text field 1 of window 1 to "test2.pdf" delay 0.5 -- use Control-d to set the desktop as the destination keystroke "d" using command down delay 0.5 click button "Save" of window "Save" delay 0.2 end tell end tell Good luck, Michael Ghilissen |
_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden Archives: http://lists.apple.com/archives/applescript-users This email sent to email@hidden
| References: | |
| >Print word document to PDF (From: Peter Baxter <email@hidden>) | |
| >Re: Print word document to PDF (From: Jeremy Sellors <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.