as far as I can see there’s no way to control the number of copies to print with Adobe Acrobat 9 with AppleScript (unless you use UI scripting which I guess I should keep away from if I can).
I can specify the first page and last page but not the number of copies - am I right?
(BTW, one reason for me not to use Skim or Preview is that not every image shows up right in those programs, in Acrobat it displays correct)
I while back I had the same problem, in that I was able to print from Acrobat but couldn’t find any options in the Acrobat Dictionary for copies. Eventually after exhausting all of the resources known to me I put the print in a repeat x times loop which did the job but meant the pdf had to be ripped x times and took a while!!! I’ve moved on a bit since then but I thought that this maybe possible by embedding JavaScript inside the applescript. After a bit of digging I managed to get it to work using this:
set NumCopies to text returned of (display dialog "Copies:" default answer "1")
tell application "Adobe Acrobat Pro"
do script "
var pp = this.getPrintParams();
var iCopies = " & NumCopies & ";
pp.NumCopies = iCopies;
pp.interactive = pp.constants.interactionLevel.silent;
this.print(pp);"
end tell
This is very basic and there are more options that you can specify but hopefully it’ll point you in the right direction.
One thing I’ve still not been able to work out is how to see the JavaScript equivalent of an Applescript dictionary. If anybody else knows of a resource to see what commands are available then please post a link.
what might me stay away from this method anyway is that it seems I cannot control the which printer to use and what printer reset to use with JavaScript.
If you want to control different printers then you could always script the ‘Printer Setup Utility’. By relaunching Acrobat after change the printer if should just use the one you set as a default.
set defaultPrinter to "the_name_of_the_printer_you_want_to_use"
set currPrinter to ""
tell application "Printer Setup Utility"
if current printer is not defaultPrinter then
set currPrinter to current printer
set current printer to printer defaultPrinter
end if
end tell
set NumCopies to text returned of (display dialog "Copies:" default answer "1")
tell application "Adobe Acrobat Pro"
activate
do script "
var pp = this.getPrintParams();
var iCopies = " & NumCopies & ";
pp.NumCopies = iCopies;
pp.firstPage = 2;
pp.lastpage = 2;
pp.interactive = pp.constants.interactionLevel.silent;
this.print(pp);"
quit
end tell
if currPrinter is not "" then tell application "Printer Setup Utility" to set current printer to printer currPrinter