🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #14896

Re: [AS] How to get the offset of a picture?

#14896
From: Armin.Egginger
Date: Thu, 15 Jan 2004 21:27
59 lines
2435 bytes
Hi Shane,

thx for your script-ideas. I thought the same way like you (2nd Version), but it didn't work with a rectangle in another position. Following doesn't function:

set picPath to "Bonbon:Users:arminegginger:Desktop:Bilder_Erwin:Erwin3"

tell application "InDesign 2.0.1"
	tell document 1
		tell rectangle 1
			get properties
			set {y1, x1, y2, x2} to geometric bounds
			set {y3, x3, y4, x4} to geometric bounds of image 1
			get properties of image 1
		end tell
	end tell
end tell

tell application "InDesign 2.0.1"
	tell document 1
		--i have to place the rectangle in another position than the origin rectangle and place the image in the same offset
		set xRectangle to make rectangle with properties {geometric bounds:{5, 5, 83, 66}}
		set {y1, x1, y2, x2} to geometric bounds of xRectangle
		place picPath on xRectangle
		tell xRectangle
			set {y3, x3, y4, x4} to geometric bounds of image 1
			set geometric bounds of image 1 to {y3 - y1, x3 - x1, y4 - y1, x4 - x1}
		end tell
	end tell
end tell

the other version (move image by...) works

set picPath to "Bonbon:Users:arminegginger:Desktop:Bilder_Erwin:Erwin3"

tell application "InDesign 2.0.1"
	tell document 1
		tell rectangle 1
			get properties
			set {y1, x1, y2, x2} to geometric bounds
			set {y3, x3, y4, x4} to geometric bounds of image 1
			get properties of image 1
			set theOffset to {x3 - x1, y3 - y1}
		end tell
	end tell
end tell

tell application "InDesign 2.0.1"
	tell document 1
		tell page 1
			set xRectangle to make rectangle with properties {geometric bounds:{5, 5, 83, 66}}
			place picPath on xRectangle
			move image 1 of xRectangle by theOffset
		end tell
	end tell
end tell

Many thanks for this scripts

Armin
Technical Details
Message-ID: <2ccf6124.1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2ccf6124.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,8bb5e41da3bf40b6
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2004-01-15 13:38:00 PST
From: Armin.Egginger@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: [AS] How to get the offset of a picture?
Message-ID: <2ccf6124.1@webx.la2eafNXanI>
Date: Thu, 15 Jan 2004 13:27:33 -0800
References: <2ccf6124.-1@webx.la2eafNXanI>
Lines: 65
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit