🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #17509

Re: A simple footnote model

#17509
From: Guy Verville
Date: Sat, 31 May 2003 15:46
57 lines
3062 bytes
Here we go, my first attempt to renumber my footnotes. And it works for the first part of the process, aka The renumbering of the CharacterStyle text. While it works, I'm wondering if there is a better way to do so.

My document has two layers. The main layers would be "Layer 1" where the text is. The second layers would contain the footnotes frames. You can find my test document at <http://www.guyverville.com/TestFolder.zip>.

This is a VBA script. It is certainly easy to convert it into a WindowsScript. I'm looking forward for your inputs! Thanks in advance.

Dim compteur, compteur2, i, j, starteur As Integer
Const AppelNote = "AppelNote"
Dim test, test1 As Variant
Set myindesign = CreateObject("InDesign.Application.2.0")
Set mydoc = myindesign.ActiveDocument

'compteur is counter; Starteur is the number I want to increment.
compteur = 0
starteur = 1

' clears find preferences
myindesign.FindPreferences = idNothing
myindesign.ChangePreferences = idNothing

' checks if "AppelNote" exists. AppelNote is the name of the characteur style
' I use to place my footnote number in text
compteur = mydoc.CharStyles.Count
If compteur > 0 Then
    For i = 1 To compteur
        test = mydoc.CharStyles.Item(i)
        If test = AppelNote Then test1 = test
    Next i
    If test1 <> AppelNote Then MsgBox "Your document doesn't contain the AppelNote character style"
Else
    MsgBox "Your document doesn't contain the AppelNote character style"
End If

' Layer 1 is where my main text is
Set mylayer1 = mydoc.Layers.Item("Layer 1")

' Counts the total textframes
compteur = mylayer1.TextFrames.Count

' Loops the Textframes
For j = 1 To compteur
    ' Counts the number of TextStyleRanges present in the TextFrame
    compteur1 = mylayer1.TextFrames.Item(j).TextStyleRanges.Count
    ' Loops the TextStyleRanges
    For i = 1 To compteur1
        'Finds the TextStyleRanges where CharacterStyle is "AppelNote"
        Set mytextstylerange = mylayer1.TextFrames.Item(j).TextStyleRanges.Item(i)
        test = mytextstylerange.CharacterStyle
            If test = AppelNote Then
            mytextstylerange.TextContents = LTrim$(starteur)
            starteur = starteur + 1
            End If
    Next i



Next j
Technical Details
Message-ID: <1de95549.2@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de95549.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,aa16bd12e0e1253e
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-05-31 09:07:37 PST
From: "Guy Verville" <taddeus@spamcop.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: A simple footnote model
Message-ID: <1de95549.2@WebX.la2eafNXanI>
Date: Sat, 31 May 2003 08:46:57 -0700
References: <1de95549.-1@WebX.la2eafNXanI>
Lines: 66
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit