Re: Setting the bounds of a QuarkXPress picture box
Re: Setting the bounds of a QuarkXPress picture box
- Subject: Re: Setting the bounds of a QuarkXPress picture box
- From: Peter Waibel <email@hidden>
- Date: Mon, 27 Jun 2005 13:53:45 +0200
Hi Tony,
with XPress 6.5 (maybe 6.x) it's easy. You can use "fit box".
So you don't have to calculate with bounds:
set top_var to 30
set left_var to 25
tell application "QuarkXPress"
tell document 1 -- makes a page automatically
tell picture box 1
--set width_var to width of bounds of image 1
--set right_var to left_var + width_var
--set height_var to height of bounds of image 1
--set bottom_var to top_var + height_var
tell image 1
set bounds to box fit
-- you have to use "box fit" within "tell image 1"
-- and it will fit the picture box to the bounds of the image
-- I don't understand the hierachy but it works!!!!
end tell
--set bounds of picture box 1 to ({top_var, left_var, bottom_var,
right_var} as measurements rectangle)
end tell
end tell
end tell
If you have to calculate with bounds you have to consider the data
types and measurement units.
I'm not sure what meaurement units you are using in your document.
Try this script:
tell application "QuarkXPress"
tell document 1 -- makes a page automatically
tell picture box 1
set myPixBoxInfo to {"picture box", class of bounds, bounds}
tell image 1
set myImgInfo to {"image", class of bounds, bounds, class of actual
bounds, actual bounds}
end tell
end tell
end tell
end tell
return {myPixBoxInfo, myImgInfo}
-->
"picture box",
measurements rectangle,
{
"15,107 mm",
"16,945 mm",
"184,44 mm",
"186,278 mm"
}
"image",
bounding rectangle,
{
0,
0,
480,
480
},
measurements rectangle,
{
"0 mm",
"169,333 mm",
"169,333 mm",
"169,333 mm"
}
You can see that:
picture box bounds returns a measurements rectangle
image bonds returns a bounding rectangle
image actual bonds returns a measurements rectangle
The units of bounding rectangle are pixel or point (I'm not sure at the
moment).
Peter
Am 27.06.2005 um 07:59 schrieb Tony White L1:
I am trying to import a folder of eps images and resize the (staggered)
picture boxes to match the size of the eps images. I am able to read
the
bounds of the image, but I do not see how to resize the image box
based on
that info.
The line below:
set bounds of picture box 1 to {top_var, left_var, bottom_var,
right_var}
Results in error message "QuarkXPress got an error: Can't set bounds of
picture box 1 of picture box 1 of current page of document 1 to {30,
25, 41,
62}." as indicated below.
Here is the script:
------------------------
set the_file_paths to {"G5:Users:accountname:Desktop:AS In
Box:Image1.eps",
¬
"G5:Users:accountname:Desktop:AS In Box:Image2.eps"}
set top_var to 30
set left_var to 25
-- using QuarkXPress 6.1
-- units set to points
tell application "QuarkXPress"
activate
tell default document 1
set properties to {page width:"8.5\"", page height:"11\""}
end tell
make document at beginning
repeat with i from 1 to (count of the_file_paths)
tell document 1 -- makes a page automatically
tell current page
make picture box at beginning with properties ¬
{bounds:{top_var, left_var, 200, 300}}
set bounds_var to bounds of picture box 1
-- log result
tell picture box 1
set image 1 to (item i of the_file_paths) as alias
--
Get Picture = Works
set width_var to width of bounds of image 1
set right_var to left_var + width_var
set height_var to height of bounds of image 1
set bottom_var to top_var + height_var
set bounds of picture box 1 to ¬
{top_var, left_var, bottom_var, right_var}
-- QuarkXPress got an error: Can't set bounds of
picture
-- box 1 of picture box 1 of current page of document 1 to {30, 25,
41, 62}.
set top_var to top_var + 5
set left_var to left_var + 5
end tell -- picture box 1
end tell -- current page
end tell -- document 1
end repeat -- with i from 1 to (count of the_file_paths)
end tell -- application "QuarkXPress"
---------------------
I searched through the past postings and did not find this covered.
Any suggestions on this would be much appreciated.
Thanks.
All the best,
Tony White
Tony White Designs, Inc.
118 Remsen Street
Brooklyn, NY 11201
Tel: 718-797-4175
email@hidden
http://www.twdesigns.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
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