Applescript - get dimensions of all frames on page
Hi all,
I’m just starting out with AppleScript, I wonder if I could trouble somebody for some advice?
The repeat loop below looks through any graphic frames on my InDesign page, gets the bounds of each frame and then changes the size of them by a set amount given by the user. (theChosenBleed)
All good so far apart from the ‘set FrameHeights’ and ‘set FrameWidths’ variables, this is saving the width/height of the first frame it finds in the loop, rather than making a list of the dimensions of every one it finds.
If there are three frames on the page, sized at 300x400mm each for example, I am getting this
FrameWidths = 300
FrameHeights = 400
What I actually need is below;
FrameWidths = 300, 300, 300
FrameHeights = 400, 400, 400
Does anybody know what I’m doing wrong?
The script is below;
repeat with oneFrame in (get all page items of layerImages)
set {a, b, c, d} to geometric bounds of oneFrame
set FrameWidths to {d-b}
set FrameHeights to {c-a}
set geometric bounds of oneFrame to {a + theChosenBleed, b + theChosenBleed, c - theChosenBleed, d - theChosenBleed}
make rectangle with properties {geometric bounds:{a + theChosenBleed, b + theChosenBleed, c - theChosenBleed, d - theChosenBleed}, stroke color:"Cut", stroke weight:2}
end repeat