🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19870

Re: Database Driven Catalog - ???

#19870
From: Brian C. Carter
Date: Tue, 19 Nov 2002 19:51
142 lines
6442 bytes
Here I go, posting all my code again. 

I just can't find it. I can't see what it is that is making myPageCounter go so wierd. I mean, when I debug, the results I'm getting from the iTextFrame label are Page2 and it's putting it in the textframe labled Page 1. So this is more error spotting then anything else. I tried doing the function Page Counter but calling functions is quite confusing when you barely know what you're doing.<g> 
=============================== 
Public Function SetupPage(oPage, iPageCounter) 

Dim myInDesign As InDesign.Application 
Set myInDesign = CreateObject("InDesign.Application.2.0") 
Set myDocument = myInDesign.ActiveDocument 
Set myPage = oPage 
'Set myPage = myDocument.Pages.Item(1) 
'Else 
'End If 
'myDocument.DocumentPreferences.NumberOfPages = 10 
myPage.AppliedMaster = myDocument.MasterSpreads.Item(1) 
myPageWidth = myDocument.DocumentPreferences.PageWidth 
myPageHeight = myDocument.DocumentPreferences.PageHeight 
myInDesign.ActiveDocument.ViewPreferences.HorzMeasurementUnits = idMSInches 
myInDesign.ActiveDocument.ViewPreferences.VertMeasurementUnits = idMSInches 
MyMarginLeft = myPage.MarginPreferences.MarginLeft 
myMarginTop = myPage.MarginPreferences.MarginTop 
myMarginRight = myPage.MarginPreferences.MarginRight 
myMarginBottom = myPage.MarginPreferences.MarginBottom 
myGutter = myPage.MarginPreferences.ColumnGutter 
myColumns = myPage.MarginPreferences.ColumnCount 
myRows = 4 
myCW = (((myPageWidth - (MyMarginLeft + myMarginRight)) - (myGutter * (myColumns - 1))) / myColumns) 
myRH = ((myPageHeight - (myMarginTop + myMarginBottom + (myGutter * (myColumns - 1)))) / myRows) 

'iPageCounter = iPageCounter + 1 

myColumnCounter = 0 
myRowCounter = 0 
Do 
    myRowCounter = 0 
        Do While myRowCounter < 4 

myTop = ((myRowCounter * myRH) + (myGutter * myRowCounter)) + myMarginTop 
            myBottom = ((((myRowCounter + 1) * myRH) + (myGutter * myRowCounter)) + myMarginTop) 
            myColumnCounter = 0 

Do While myColumnCounter < 4 

myLeft = ((myColumnCounter * myCW) + (myGutter * myColumnCounter)) + MyMarginLeft 
                            myRight = (((myColumnCounter + 1) * myCW) + (myGutter * myColumnCounter)) + MyMarginLeft 

Set myTextFrame = myPage.TextFrames.Add 
                            myTextFrame.GeometricBounds = Array(myTop, myLeft, myTop + (myRH / 4), myRight) 
                            myTextFrame.Label = "Name-" & iPageCounter & "-" & myColumnCounter + 1 & "-" & myRowCounter + 1 



Set myTextFrame2 = myPage.TextFrames.Add 
                            myTextFrame2.GeometricBounds = Array(myBottom - (myRH / 8), myRight, myBottom, myLeft) 
                            myTextFrame2.Label = "Info-" & iPageCounter & "-" & myColumnCounter + 1 & "-" & myRowCounter + 1 

Set myRectangle1 = myPage.Rectangles.Add 
                            myRectangle1.GeometricBounds = Array(myTop + (myRH / 4), myLeft, myBottom - (myRH / 8), myRight) 
                            myRectangle1.Label = "Photo-" & iPageCounter & "-" & myColumnCounter + 1 & "-" & myRowCounter + 1 

myColumnCounter = myColumnCounter + 1 
                Loop 
            myRowCounter = myRowCounter + 1 
        Loop 
    If myRowCounter = 4 Then 
    Exit Do 
    End If 
Loop 

End Function 

Public Function DBtoID() 
Dim db As DAO.Database 
Dim rs As DAO.Recordset 
Set db = CurrentDb 
Set rs = db.OpenRecordset("Madison Items", dbOpenDynaset) 
Dim myInDesign As InDesign.Application 
Set myInDesign = CreateObject("InDesign.Application.2.0") 
Set myDocument = myInDesign.ActiveDocument 
myInDesign.Activate 
Set myPage = myDocument.Pages.Item(1) 
myColumnCounter = 0 
myRowCounter = 0 

iPageCounter = 1 
SetupPage myPage, iPageCounter 

Do While Not rs.EOF 

Do While myRowCounter < 4 



Do While myColumnCounter < 4 

sBuf1 = rs!Pre 
                        sBuf2 = rs!Description 
                        sBuf3 = rs!Sub 
                        iFrame = "Name-" & iPageCounter & "-" & myColumnCounter + 1 & "-" & myRowCounter + 1 
                        Set iTextFrame = myPage.TextFrames.Item(iFrame) 
                        iTextFrame.InsertionPoints.Item(-1).TextContents = sBuf1 & vbCr & sBuf2 & vbCr & sBuf3 

Debug.Print iFrame 

sBuf4 = rs!Number 
                        sBuf5 = rs!Pak 
                        iFrame2 = "Info-" & iPageCounter & "-" & myColumnCounter + 1 & "-" & myRowCounter + 1 
                        Set iTextFrame2 = myPage.TextFrames.Item(iFrame2) 
                        iTextFrame2.InsertionPoints.Item(-1).TextContents = sBuf4 & vbTab & sBuf5 
                        iTextFrame2.Paragraphs.Item(1).Justification = idCenter 

On Error Resume Next 
                        sBuf4 = rs!Number 
                        myFile = "D:\Madison\" & sBuf4 & ".eps" 
                        irFrame = "Photo-" & iPageCounter & "-" & myColumnCounter + 1 & "-" & myRowCounter + 1 
                        Set iRectFrame = myPage.Rectangles.Item(irFrame) 
                        iRectFrame.Place myFile 
                        iRectFrame.Fit idProportionally 
                        iRectFrame.Fit idCenterContent 

rs.MoveNext 

myColumnCounter = myColumnCounter + 1 

Loop 

myColumnCounter = 0: myRowCounter = myRowCounter + 1 

Loop 

If myRowCounter = 4 Then 
        Set oPage = myDocument.Pages.Add 
        iPageCounter = iPageCounter + 1 
        SetupPage oPage, iPageCounter 
        myColumnCounter = 0: myRowCounter = 0 
        End If 

Loop 

rs.Close 
End Function 
=========================
Technical Details
Message-ID: <1de69529.34@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!diablo.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de69529.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,4348409c0a586298
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-11-19 14:01:13 PST
From: "Brian C. Carter" <brian@samardist.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!diablo.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Database Driven Catalog - ???
Message-ID: <1de69529.34@WebX.la2eafNXanI>
Date: Tue, 19 Nov 2002 11:51:38 -0800
References: <1de69529.-1@WebX.la2eafNXanI>
Lines: 167
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit