If you're looking for a simple way to print from the desktop in Word X
through an applescript, the following script would work (this is just code
for the printing). By the way - command line is not an option.
tell application "Microsoft Word"
activate
set theDoc to <enter mac path to the file here> --something like "Mac OS
X: users: me: documents: mydoc"
do Visual Basic "application.displayalerts - wdAlertsNone"
do Visual Basic "activedocument.printout"
do Visual Basic "application.displayalerts - wdAlertsAll"
quit saving no
end tell
Here is some explanation of why I wrote it this way:
I use visual basic commands because the Office suite "print" command in
version X Applescript with bring up the Print Dialog - I'm guessing you do
not want that. Also - I'm guessing that you are trying to get a fast
printout without any app interaction. That is why I quit word at the end. It
also explains why I used the visual basic "displayalerts" method. In the two
lines that use it, I am telling word to (1) accept all alert defaults and
(2) show all alerts again - this is because I need to set it back to show
all alerts afterwards as it won't get set back otherwise. Why do I do this?
so that margin warnings won't stop the script.
In order to really get this script to approach something that runs from the
desktop, you would need to make it into a droplet script where you drag the
file you want to print onto the script and that then becomes the variable
"theDoc". I won't go into how to do that in Applescript here as I'm sure
others are eeking to tell you
--
Rob Daly
Macintosh Business Unit
Word Test
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this e-mail address. It is for
newsgroup purposes only.
Find out everything about Microsoft Mac Newsgroups at:
http://www.microsoft.com/mac/community/community.aspx?pid=newsgroups
Check out product updates and news & info at:
http://www.microsoft.com/mac