Re: Quark print property mismatch
Re: Quark print property mismatch
- Subject: Re: Quark print property mismatch
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 18 Jan 2006 23:46:43 -0800
- Thread-topic: Quark print property mismatch
Title: Re: Quark print property mismatch
On 1/18/06 11:08 PM, "Brett Conlon" <email@hidden> wrote:
Hi all,
Hopefully there's a simple answer to the following.
The following script asks the user to choose the type of output they want. It then uses the two words returned as separate values.
The first word (eg. A4) works fine because the property uses quotes to define the value (eg. paper size:"A4").
The second value stops the script with an error as it requires a value without quotes (orientation:portrait)
set PaperSize to item 1 of (choose from list {"A4 Portrait", "A4 Landscape", "A3 Portrait", "A3 Landscape", "Custom"} with prompt "Choose the appropriate PDF paper size:")
set pSize to first word of PaperSize
set pOrient to word 2 of PaperSize
tell document 1
set properties of print setup to ¬
{separation:false, print spreads:false, collate:false, include blank pages:false, print thumbnails:false, back to front:false, page sequence:odd pages, registration marks:centered, registration marks offset:"6 pt", tiling:off, printer type:"Adobe PDF", paper size:pSize, paper offset:"0 mm", page gap:"0 mm", reduce or enlarge:"100%", fit in area:false, page position:center position, orientation:pOrient, print colors:composite CMYK, resolution:1200, halftone screen:"100"}
print
end tell
The error is: "A descriptor type mismatch occurred"
>From the Events Log I can see the following showing in the properties: orientation:"Portrait"
Is it possible to have it return just portrait (sans quotes)?
Many thanks,
Isn't it possible to have what return portrait? (Why "return"?) It's returning what you gave it, namely word 2 of the string "A4 Portrait", which is a string "Portrait". In quotes, naturally. (By the way, you've surely set yourself up for an error if the user chooses "Custom", since there's no word 2.)
Naturally 'choose from list' needs strings (or Unicode). I don't have Quark, but if portrait' (no quotes) is an enumeration or property there, it ought to compile inside a Quark tell block (which you have omitted, for some reason). Then you can
tell app "Quark XPress" -- or whatever it's called
set PaperSize to item 1 of (choose from list {"A4 Portrait", "A4 Landscape", "A3 Portrait", "A3 Landscape", "Custom"} with prompt "Choose the appropriate PDF paper size:")
set pSize to first word of PaperSize
try
set pOrient to word 2 of PaperSize
on error
set pOrient to "Custom" -- or whatever it ought to be
end try
if pOrient = "Portrait then
set pOrient to portrait
else if pOrient = "Landscape" then
set pOrient to landscape
else if ...
--etc
end if
tell document 1
set properties of print setup to ¬
--- etc
end tell
end tell
The other way to do it would be to
set pOrient to run script pOrient
but that can lead you into trouble under some circumstances.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden