Printing in Word 2004 with Applescript

P

pokeyarw

Version: 2004
Operating System: Mac OS X 10.5 (Leopard)
Processor: intel

I'm a pretty good shell programmer, but Applescript is not my forté.
It seems you should be able to get Word to print a file and control the printing panel with either Macros or Applescript. However, as printing seems to be a system function, Word doesn't have any facility to rill in the blanks on the Print interface panel.
What I'd like to do is print a file to a pdf file on my Mac.
Actually, I want to use Automator to create a workflow that involves getting a pdf file from a Word file and emailing it. I've got all the stuff done except the pdf thing.
 
D

Daiya Mitchell

Interesting question.....

I'm a very novice scripter myself and no kind of programmer, but it's
not printing that Word can't control, but the PDF thing. (I used to have
a macro to Print Selection, and I could applescript one, ref page 313 of
the Word 2004 Applescript Reference). I'd say you need to ask OS X
scripters about how to trigger the Save as PDF option in the Print
dialog with a script. I did a little googling without luck (seems can't
be done in Safari either), and I don't see anything in Automator to do
this for *any* program. Appears to be a random roadblock from Apple.

Alternatively, on my system Adobe CS2 has installed a PDF Printer.
AppleScript should let you pick a printer, and I would imagine that
could be a PDF printer. I googled "automator print to pdf" and got this
old reference on setting up a PDF printer in the OS, which might help
suggest a workable approach. Other results also looked relevant.
http://www.macgeekery.com/gspot/2005-12/how_to_mass-print_to_pdf

If you put an alias to Entourage in user/Library/PDF Services, then File
| Print, select Entourage from the PDF menu will print the doc to PDF
and attach it to a new message in Entourage. (This is already set up for
Mail. Not sure if you can do it for Thunderbird or other programs, but
I'd guess so.) Still a couple of clicks. I don't like this system
because the file name comes out weird, but there is an Automator Action
out there with an improved version of the same system for Mail, so that
approach could work and be improved upon.

Just FYI: Office 2008 includes some 90 automator actions, including a
sample Automator workflow in Word that prints to PDF and attaches to new
message in Entourage (which could be tweaked to use Mail, etc, I
assume). However, Word 2008 has a built-in PDF creator which seems to do
not much (still doesn't create bookmarks in a PDF), but the Automator
Action uses this built-in creator, not the system creator.
 
D

Daiya Mitchell

P

pokeyarw

Thanks for the effort.

I did a little thinking on the subject and it seems to me that it probably cannot be done in a clean way with which a good programmer might like to associate him/herself.

Word obviously doesn't know anything about the nature of the printing that is to be done as indicated by the lack of relevant information in the macro call for printing to be done. So, there has to be a function (the "print" system call) which gathers the information about the nature of the printing to be done.

As Word is asking for a system function by going directly deeper into the system, Applescript cannot know anything about what is going on. It seems one would have to somehow pass the print request back out to a (at present undefined) Applescript print command of some sort which would gather the information or allow it to be parameterized.

ARW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top