On Jan 10, 2012, at 8:12 AM, theDaniel wrote: Really, I like Joe's solution better - less clicking, but here's another option: Works for me.
I just took a look at the PDFwriter doc where I noticed ...
History Unlike CUPS-PDF, PDFwriter doesnʻt use ghostscript to generate PDF files. PDFwriter uses the Mac OS X internal pdf capabilities. This will result in small files sizes, whereas CUPS-PDF generated files are really huge.
I may want to re-write my script to use either of these PDF printers. Whatever the user has installed.
Also, this discussion caused me to take a new look at old code.
tell application "System Events" tell process "Mail" -- -- -- keystroke "p" using {command down} -- -- -- keystroke return -- click button "Print" of sheet 1 of window 1 -- start printing with process "CUPS-PDF" end tell
Notice that I've changed the last line. Would 'click button "Print" ...' work in French? German? But 'keystroke return' is internationalized.
Use of both "CUPS-PDF" and "PDFwriter" require a minimal use of UI scripting. It doesn't matter if "Save as PDF..." is used from the File menu or the Print dialog, it still requires UI scripting. The only way to avoid UI scripting (and I really, really want to avoid it) is to have a 'printToPDF' AppleScript command as standard in the dictionary of every application that prints. I'm not holding my breath.
|