🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #17384

Re: Aligne images

#17384
From: Dave Saunders
Date: Mon, 16 Jun 2003 13:29
25 lines
1955 bytes
There are examples to be found in this forum (and its archive), but they might take some tracking down.

The first issue you'll face is determining which images you're talking about. Let's say you have a variable called myImages into which you've put a list of references to the images of interest:

tell application "InDesign 2.0.2"
 set minX to 100000 -- ridiculously large number
 set maxX to -100000 -- ridiculously negative number
 set itemCenters to {}
 repeat n from 1 to count of myImages
  set myBounds to visible bounds of item n of myImages
  if item 2 of myBounds < minX then set minX to item 2 of myBounds
  if item 4 of myBounds > maxX then set maxX to item 4 of myBounds
  copy ((item 4 of myBounds + item 2 of myBounds)/2) to end of itemCenters
 end repeat
set targCenter to (maxX + minX)/2
-- at this point each item center is in the itemCenters, so
repeat n from 1 to count of myImages
 set myMove to targCenter - (item n of itemCenters)
 move item n of myImages by {myMove,0}
end repeat
end tell

I just typed that off the top of my head, so there might be some errors, but I hope that gives you and idea of the process.

Dave
Technical Details
Message-ID: <1de98ce2.2@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de98ce2.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,b5dc5ea33bd87bbb
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-06-16 06:37:41 PST
From: "Dave Saunders" <daves@pdsassoc.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Aligne images
Message-ID: <1de98ce2.2@WebX.la2eafNXanI>
Date: Mon, 16 Jun 2003 06:29:10 -0700
References: <1de98ce2.-1@WebX.la2eafNXanI>
Lines: 30
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit