🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8948

VB Help - Automating frames and flow...

#8948
From: Ken_Krugh
Date: Thu, 21 Sep 2006 16:43
47 lines
2476 bytes
I'm writing an InDesign script in VB that finds the last text frame in a document and, if it overflows, continues to add pages/text frames until there is no longer any overflow. The code works once, on an initial right hand page, but when it gets to the left hand page the text frame gets drawn on the right hand page, but when I try to set the boundaries the text box page is re-drawn on the left hand page. (See comments in code for the exact location of the problem)

Thanks in advance for your help!
Steven Lee
Vaporloop Technology Solutions
steve At vaporloop Dot com

'##############code starts here##################
Sub Main()
Dim inD As InDesign.Application
Dim theDoc As InDesign.Document
Dim thePg As InDesign.Page
Dim theFrame As InDesign.TextFrame
Dim newPg As InDesign.Page
Dim NewFrame As InDesign.TextFrame

Set inD = CreateObject("InDesign.Application.CS2")
Set theDoc = inD.Documents(1)
Set thePg = theDoc.Pages.LastItem
Set theFrame = thePg.TextFrames.LastItem

'get the size we are going to make the text box

With theDoc
theTop = .MarginPreferences.Top
theLeft = .MarginPreferences.Left
theBot = .DocumentPreferences.PageHeight - .MarginPreferences.Bottom
theRight = .DocumentPreferences.PageWidth - .MarginPreferences.Right
End With

FrmBounds = Array(theTop, theLeft, theBot, theRight)

Do Until theFrame.Overflows = False 'keep going until there's no more text
    theDoc.Pages.Add (idAtEnd)
    Set newPg = theDoc.Pages.LastItem

With newPg
           Set NewFrame = .TextFrames.Add("Layer 1")
           NewFrame.GeometricBounds = FrmBounds 'works 1st time on LH page, breaks on next RH page
           NewFrame.PreviousTextFrame = theFrame
    End With

Set theFrame = newPg.TextFrames.LastItem

Loop

End Sub
Technical Details
Message-ID: <3bc1b9db.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.albasani.net!news.motzarella.org!news.isoc.lu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,26055e7a19463a28,start
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Ken_Krugh@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeed.freenet.de!news.albasani.net!news.motzarella.org!news.isoc.lu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: VB Help - Automating frames and flow...
Message-ID: <3bc1b9db.-1@webcrossing.la2eafNXanI>
Date: Thu, 21 Sep 2006 09:43:02 -0700
Lines: 55
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit