Re: What's the easy way to do this?
Re: What's the easy way to do this?
- Subject: Re: What's the easy way to do this?
- From: email@hidden (Michael Sullivan)
- Date: Fri, 28 Jun 2002 13:03:17 -0400
- Organization: Society for the Incurably Pompous
>
On 28/6/02 2:43 AM +1000, Michael Sullivan, email@hidden, wrote:
>
>
>> On 26/6/02 10:42 PM +1000, Steve, email@hidden, wrote:
>
>>
>
>>> I have a script controlling Xpress 4.11
>
>>>
>
>>> It brings in some artwork into a picture box and then does this...
>
>>>
>
>>>
>
>>> tell image 1
>
>>> set scale to {"70", "70"}
>
>>> set bounds to centered
>
>>> set tempbnds to the bounds of me as list
>
>>
>
>> Be warned that the bounds of an image is unreliable.
>
>
>
> You bet it is -- I was going to suggest roughly what you did below, but
>
> tried it in SD first because I know how Xpress is...
>
>
>
> It won't get left, or top of bounds.
>
> What's really interesting is that if I convert *any* bounds to a "fixed
>
> rectangle", then I can't use Xpress to get the individual pieces via
>
> 'top' or 'left'.
>
>
>
> There also doesn't seem to be any way to pull out strings from this
>
> either, pretty much anything I try to do with that errors.
>
Either get the left and top separately:
>
>
set theLeft to left of bounds
Nope.
here's my test script:
tell application "QuarkXPress 4.11"
tell document 1
set thebounds to bounds of image 1 of generic box 1
--> {0, 0, 170, 196} Looks fine.
set theLeft to left of thebounds
--> error: Can't get left of {0, 0, 170, 196}
set theLeft to left of bounds of image 1 of generic box 1
--> error: QuarkXPress 4.11 got an error: Can't get left of
-- bounds of image 1 of generic box 1 of document 1
end tell
end tell
-->
>
or use coerce:
>
set theBounds to coerce bounds to list
That doesn't work too well either:
tell application "QuarkXPress 4.11"
tell document 1
tell generic box 1
tell image 1
set thebounds to coerce bounds to list
end tell
end tell
end tell
end tell
--> {bounds of image 1 of generic box 1 of document 1 of application
"QuarkXPress 4.11"}
Very helpful. (I Mean Xpress, not you...) I think you want:
set thebounds to coerce (get bounds) to list
Now *THAT* finally works.
Thank you...
In any case, converting to fixed:
set thebounds to coerce (get bounds as fixed) to list
Now that I go back, offset appears to work a little bit better than
bounds:
tell application "QuarkXPress 4.11"
tell document 1
set horizontal measure to centimeters
set vertical measure to centimeters
tell generic box 1
tell image 1
set theoffset to coerce (offset as fixed point) to list
set item 1 of theoffset to ((item 1 of theoffset as
[NO-BREAK]string as real)) + 1
set offset to theoffset
offset
end tell
end tell
end tell
end tell
Seems to produce the result the OP was looking for. It's still a
horribly broken object model (with horizontal and vertical not working,
etc.), but at least you can get it to work.
Bounds of images has the interesting property that it is aways returns
as numbers (not fixed, which has no unit info, but look like strings),
and always returned points in my tests, no matter what I had set the
measures to.
Coercing said bounds to centimeters rectangle, succeeded only in adding
" cm" to the end of each measure! It did not convert from points to cm.
In fact, the only way I could verify that it was points was to measure
my image bounds on the screen.
What it may be returning is pixels of the preview image (which would map
to points), but unless the bounds of boxes, it will break when trying to
convert to a measurement. It assumes the numbers already represent what
you're converting to, rather than the document's measure.
Caramba. I'm really starting to think it's time to look at Indesign.
Michael
--
Michael Sullivan
Business Card Express of CT Thermographers to the Trade
Cheshire, CT 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.