🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #16349

Re: [VB] Working with GeometricBounds

#16349
From: Guy Verville
Date: Fri, 26 Sep 2003 01:46
102 lines
3402 bytes
Finally, I got this work, with the precious help of you all! Thanks!
Here is the complete routine. Note that I must take into account the page position into the spread. Perhaps there is a better way to work?

The calculation of the recto/verso placements of the textframes could be set outside the Pages loop since, usually, this type of Footnotes will be for a "regular" book.

I will try to indent my codes here correctly!

Dim k,verso, MarginB, MarginL, MarginR, FrameHeight, P_Width, P_Height, NombrePages
Set myID = CreateObject("InDesign.Application.2.0")
Set myDoc = MyID.ActiveDocument
Set myLib = myID.open("f:\production\Librairie g�n�rale.indl")
Set CDN= myLib.Assets.Item("Note")

With MyDoc

      	.ViewPreferences.HorzMeasurementUnits= idMSInches
      	.ViewPreferences.VertMeasurementUnits =idMSInches
      	P_Width=.DocumentPreferences.PageWidth
      	P_Height=.DocumentPreferences.PageHeight
      	NombrePages = .Pages.Count
      End With	





For k =1 to NombrePages

      	Set myPage = myDoc.Pages.Item(k)
      	MyPageBounds=MyPage.Bounds
      	'Place the asset in the Document
      	CDN.Place myPage
      	'Select the asset
      	Set DocCDN = myID.Selection.Item(1)






      	'Move it to the correct page.
      	DocCDN.Move myPage






      	'Get the Margins of the pages
      	MarginB=myPage.MarginPreferences.MarginBottom
      	MarginL=myPage.MarginPreferences.MarginLeft
      	MarginR=myPage.MarginPreferences.MarginRight






      	'Get the TextFrame GeometricBounds	
      	myBounds = DocCDN.GeometricBounds
      	myFrameHeight = myBounds(2)-myBounds(0)






      	'Has to take into account Spread
      	verso = k mod 2
      	Select Case verso
      		Case 0 'Recto! Weird enough, this doesn't affect Page 1!
      			myBounds(0) = P_Height- MarginB - myFrameHeight
      			myBounds(1) = P_Width+MarginL
      			myBounds(2) = P_Height-MarginB
      			myBounds(3) = P_Width*2 - MarginR
      		Case Else
      			myBounds(0) = P_Height- MarginB - myFrameHeight
      			myBounds(1) = MarginL
      			myBounds(2) = P_Height-MarginB
      			myBounds(3) = P_Width - MarginR
      	End Select
      	DocCDN.GeometricBounds = myBounds






      	'Label it
      	DocCDN.Label = "CDN" & LTrim(k)
      	'Thread it
      	If k>1 Then
      		Set prvDocCDN =MyDoc.TextFrames.Item("CDN"&LTrim(k-1))
      		DocCDN.PreviousTextFrame= prvDocCDN
      	End if





Next
MsgBox ("Finish")
Technical Details
Message-ID: <2ccd88b5.14@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!newshosting.com!news-xfer1.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2ccd88b5.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f939a,34141f6e382b2aea
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-09-25 19:09:49 PST
From: "Guy Verville" <taddeus@spamcop.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!newshosting.com!news-xfer1.atl.newshosting.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: [VB] Working with GeometricBounds
Message-ID: <2ccd88b5.14@webx.la2eafNXanI>
Date: Thu, 25 Sep 2003 18:46:27 -0700
References: <2ccd88b5.-1@webx.la2eafNXanI>
Lines: 66
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit