Article View: adobe.scripting.indesign
Article #17377Re: A simple footnote model
From: Guy Verville
Date: Mon, 16 Jun 2003 01:22
Date: Mon, 16 Jun 2003 01:22
52 lines
2827 bytes
2827 bytes
Here's the same script, but in VBScript. Save it in a text file ending with .vbs and place it in your script folder.
Dim i, j, k, starteur, starteur2
Const AppelNote = "AppelNote"
Const ChiffreNote = "ChiffreNote"
Set myindesign = CreateObject("InDesign.Application.2.0")
Set MyDoc = myindesign.ActiveDocument
' clears find preferences
myindesign.FindPreferences = idNothing
myindesign.ChangePreferences = idNothing
' checks if "AppelNote" or "ChiffreNote" exists. AppelNote is the name of the characteur style
' I use to place my footnote number in text
If MyDoc.CharStyles.Count > 0 Then
For i = 1 To MyDoc.CharStyles.Count
Select Case MyDoc.CharStyles.Item(i)
Case AppelNote
j = 1
Case ChiffreNote
k = 1
End Select
Next
End If
If j = 0 Or k = 0 Then
MsgBox ("Please make sure you have the necessary CharacterStyle set in your pub.")
Else
'Loops through the pages
For k = 1 To MyDoc.Pages.Count
Set mypage = MyDoc.Pages.Item(k)
' Loops the Textframes
For j = 1 To mypage.TextFrames.Count
Set myTSRs = mypage.TextFrames.Item(j).TextStyleRanges
' Loops through the TextStyleRanges
For i = 1 To myTSRs.Count
'Finds "AppelNote" and "ChiffreNote"
With myTSRs.Item(i)
'test = .CharacterStyle
Select Case .CharacterStyle
Case AppelNote
starteur = starteur + 1
.TextContents = LTrim(starteur)
Case ChiffreNote
starteur2 = starteur2 + 1
.TextContents = LTrim(starteur2) & "."
End Select
End With
Next
Next
Next
MsgBox ("Finish")
End If
Technical Details
Message-ID:
<1de95549.7@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!sn-xit-09!supernews.com!news.maxwell.syr.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<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-06-15 18:37:42 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-08!sn-xit-09!supernews.com!news.maxwell.syr.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.7@WebX.la2eafNXanI> Date: Sun, 15 Jun 2003 18:22:21 -0700 References: <1de95549.-1@WebX.la2eafNXanI> Lines: 55 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit