Hello
(1) As this piece of code is a subset of a larger script I wish to get a precision.
Are you using the Finder to set the variable oneFile or are you using my edited version which use System Events ?
With System Events, oneFile is a string so coercing it as alias is required but if you use the Finder, if I remember well, oneFile is an alias so trying to coerce it as an alias generates an error.
(2) Are you sure that the piece of code which you use to set the printer to use is doing correctly its job ?
Given the error message, I’m wondering if it really does.
For those which are unaware of the complete script, it’s available at :
http://macscripter.net/viewtopic.php?id=41244
To be short, the code supposed to select the printer is :
choosePrinter()
on choosePrinter()
tell application "Printer Setup Utility"
set printerList to name of every printer
end tell
choose from list printerList with prompt "Choose the printer you wish to use."
set thePrinter to item 1 of result
tell application "Printer Setup Utility"
set current printer to first printer whose name is thePrinter
end tell
end choosePrinter
I have only one printer (out of function at this time) so I can’t test this code.
In the pointed thread, I gave you a link to a web site extensively dealing with printing from inDesign using AppleScript.
I looked quickly at the different lessons and in all of them the instruction used to print is :
print using (mgPrintPreset as string) without print dialog
In your script, you use :
print without print dialog
Yes, the piece of code “using (mgPrintPreset as string)” is missing
May you look at inDesign AppleScript dictionary to check if this one is optional or required ?
If it’s required, it’s probably what is causing the error.
KOENIG Yvan (VALLAURIS, France) mardi 30 juillet 2013 18:53:29