RE: Re: clipping path bounds
RE: Re: clipping path bounds
- Subject: RE: Re: clipping path bounds
- From: email@hidden
- Date: Thu, 29 Mar 2012 12:38:13 +0200
Hi Stan,
First of all thank you very much for the research and time spend on this.
This seems to work for CS4:
tell application "Adobe InDesign CS4"
tell document 1
tell rectangle 1 of page 1
set properties of clipping path of item 1 of all graphics to ¬
{clipping type:photoshop path, applied path name:"Path 1"}
fit given frame to content
set {t, l, b, r} to geometric bounds -- top, left, bottom, right
end tell
undo
undo
end tell
end tell
Much appreciated,
/J
On Mar 26, 2012, at 3:08 AM,
email@hidden wrote:
Does anyone know the right syntax to get the bounds of a clipping path of a placed image in Indesign?
---snip
set {ImageY1
, ImageX1
, ImageY2
, ImageX2
} to geometric bounds of TheImage
FrameY1, FrameX1, FrameY2, FrameX2}
to geometric bounds of TheFrame---snipI can get the bounds of t heframe and image, but I need the clipping path bounds if present.Hi j,
The
method I'll suggest is a workaround and somewhat intrusive, because it requires modifying the InDesign layout. Specifically, the rectangle that contains the image will be resized. However, this change won't be evident IF you are in the habit of placing images with clipping paths into otherwise empty (i.e. - unfilled and unstroked) rectangles. Alternatively, you could restore the original bounds of the rectangle after getting the information you need. Take note of the version-specific syntax.
tell application "Adobe InDesign CS5"
set usingInDesignCS5orNewer
to version > "7" tell rectangle
1 of page
"1" of document
1
-- use one of the following two commands to activate the desired image clipping path within InDesign
-- however, neither command is needed if a clipping path is already assigned within the image file
if usingInDesignCS5orNewer
then set properties
of clipping path
of item
1 of all graphics
to ¬ {clipping type
:photoshop path
, applied path name
:"Path 1"} else -- InDesign CS4 or older (not sure how far back this works)
set properties
of contour option
of item
1 of all graphics
to ¬ {contour type
:photoshop path
, contour path name
:"Path 1"} end
if
-- this will resize the parent rectangle to the bounds of the image clipping path
fit
given
frame to content
-- get the bounds of the rectangle, which now match the bounds of the image clipping path
set {t, l, b, r} to geometric bounds
-- top, left, bottom, right set {
w,
h}
to {
r -
l,
b -
t}
-- width and height, if desired
end
tell
end
tell
Hope that all makes sense.
Stan C.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden