Re: QXP Experts
Re: QXP Experts
- Subject: Re: QXP Experts
- From: Hans Haesler <email@hidden>
- Date: Thu, 27 Feb 2003 15:38:32 +0100
On Thu, 27 Feb 2003, Scott Lewis wrote:
>
Is there a command in QXP to center images in picture box via AppleScript?
>
Here is how I am currently doing this: (of course this is within the proper
>
tell QXP and tell page and tell picture box blocks).
>
>
Note: theWidth and theHeight are extracted from the images comment which
>
Photoshop adds when saving the image file.
[snip]
>
My code is really long and I am hoping there is a quicker way to do this. If
>
not, this works but I thought I could trim some fat if there is.
Hello Scott,
I'm using the following script which fits the image to the box with the
smallest possible percentage. But it adds about half a percent to be on
the safe side: the offset values must be negative ones, especially when
the box has a frame (else, there will be a white hairline for sure):
---
tell document 1 of application "QuarkXPress 4.11"
activate
tell current box
tell image 1
if bounds is not {0, 0, 0, 0} then
set bounds to exact fit
set {yP, xP} to scale as list
set yP to yP as real
set xP to xP as real
if yP > xP then
set yP to ((yP + 0.5) div 0.1) / 10
set xP to yP
else
set xP to ((xP + 0.5) div 0.1) / 10
set yP to xP
end if
set scale to {yP, xP}
set bounds to centered
end if
end tell
end tell
end tell
---
With 'set bounds to centered' the image is centered in the box. No need
for trying to compute the offset values.
---
Hans Haesler <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.
References: | |
| >QXP Experts (From: Scott Lewis <email@hidden>) |