🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #14873

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

#14873
From: Shane_Stanley
Date: Thu, 15 Jan 2004 10:33
37 lines
1676 bytes
First you need to calculate the offset:

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


Then when you want to place the picture:

tell application "InDesign CS"
	tell document 1
		set {y1, x1, y2, x2} to geometric bounds of rectangle 1
		place picPath on rectangle 1
		move graphic 1 of rectangle 1 by theOffset
	end tell
end tell

or:

tell application "InDesign CS"
	tell document 1
		set {y1, x1, y2, x2} to geometric bounds of rectangle 1
		place picPath on rectangle 1
		set {y3, x3, y4, x4} to geometric bounds of graphic 1
		set geometric bounds of graphic 1 to {y3 - y1, x3 - x1, y4 - y1, x4 - 
x1}
	end tell
end tell

--
Shane Stanley <sstanley@myriad-com.com.au>
Technical Details
Message-ID: <46D1F0B2-4746-11D8-B512-003065D61B90@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!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 02:37:34 PST
From: Shane_Stanley@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!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: <46D1F0B2-4746-11D8-B512-003065D61B90@myriad-com.com.au>
Date: Thu, 15 Jan 2004 02:33:36 -0800
References: <2ccf6124.-1@webx.la2eafNXanI>
Lines: 39
X-Mailer: Apple Mail (2.609)
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit