🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20471

Re: Images Size - InDesign Script

#20471
From: Benny Johnson
Date: Mon, 15 Jul 2002 08:22
32 lines
1981 bytes
Hi Micha, 

You want the text box to be directly beneath the image frame and you want it to be the same size as the image? Okay, try this: 

Set myInDesign = CreateObject("InDesign.Application.2.0") 
Set myDocument = myDocuments.Add 

For i = 1 to 5 

Set myPage = myDocument.Pages.Add 
myFile = "f:\bilder florida\Film1\" & i & ".tif"  
Set myImage = myPage.Place(myFile, placePoint:=Array("6p", "6p"))  
Set mySelection = myPage.PageItems.Item(1) 
myBounds = mySelection.GeometricBounds 
Y1 = myBounds(0) 
X1 = myBounds(1) 
Y2 = myBounds(2) 
X2 = myBounds(3) 
Set myTextFrame = myPage.TextFrames.Add 
myTextFrame.GeometricBounds = Array(Y2, X1, (Y2 + (Y2 - Y1)), X2) 
Rem IF YOU WANT THE TEXT BOX TO HAVE A SMALLER HEIGHT, JUST CHANGE THE 
Rem 3RD ARRAY ITEM). THE WAY IT IS NOW MIGHT CAUSE THE BOX TO GO OFF  
Rem THE PAGE AND ERROR OUT! 
myTextFrame.TextContents = "1" 

Next i 

That's a 2 minute code-jobbie, but basically you want to get the object dimensions of the image you just placed and then create a textbox using those dimensions (which are stored in an array) with the appropriate manipulations. You may have to tailor the code up a bit to work with your original code. 

Hope that helps, 

Benny
Technical Details
Message-ID: <ef98a39.0@WebX.aaQKaf7vad4>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <ef98a39.-1@WebX.aaQKaf7vad4>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,56cf2cbc66002471
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-07-15 01:44:05 PST
From: "Benny Johnson" <allstarx22@aol.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Images Size - InDesign Script
Message-ID: <ef98a39.0@WebX.aaQKaf7vad4>
Date: Mon, 15 Jul 2002 01:22:39 -0700
References: <ef98a39.-1@WebX.aaQKaf7vad4>
Lines: 37
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit