Re: Scripting InDesign 2 to print to file
Re: Scripting InDesign 2 to print to file
- Subject: Re: Scripting InDesign 2 to print to file
- From: Shane Stanley <email@hidden>
- Date: Tue, 22 Oct 2002 14:06:31 +1000
On 22/10/02 11:03 AM +1000, Bob Averill, email@hidden, wrote:
>
I'm having problems scripting InDesign 2 to print to file. It works fine
>
when I use the "with print dialog" property, but it fails to write anything
>
when I use "without print dialog".
>
>
What am I doing wrong?
>
>
Thanks.
>
>
Bob Averill
>
>
________________________________________
>
>
tell application "InDesign 2.0.1"
>
set theDoc to active document
>
tell theDoc
>
set properties of print preferences to {print to disk:yes, print
>
file:"Macintosh HD:Desktop Folder:test2.ps"}
>
print using "Style 1" without print dialog
>
end tell
>
end tell
The main problem is that the print style has a "print file" property that
sets the path to print to, and this is an empty string. So using print
styles directly for printing to files isn't the way to go.
You'd do better to get the properties of the printer style, modify them to
reflect the desired path for the file, and set the print preferences of the
document to them. Something like:
tell application "InDesign 2.0.1"
set theDocPath to full name of document 1
set theProps to properties of printer style "Style 1"
set theProps to {print to disk:true, printer:postscript file, print
file:theDocPath & ".ps"} & theProps
set properties of print preferences of document 1 to theProps
print document 1 without print dialog
end tell
Note that "print to disk" takes a boolean true or false, not yes or no. If
you're wondering why that didn't generate an error in your script, be aware
that if you set multiple properties in a single event in InDesign, as long
as at least one of the properties is set validly, there will be no error.
This is something to watch when debugging (and a blessing when scripting
generally).
--
Shane Stanley, email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.