Article View: adobe.scripting.indesign
Article #19474Re: Auto Numbering
From: amjb
Date: Tue, 10 Dec 2002 16:49
Date: Tue, 10 Dec 2002 16:49
55 lines
2805 bytes
2805 bytes
Is there a way to set a Character style to the numbers, I have tryed this:
property thisStyle : {"11 - Text - Numbered"}
-- based on the content of the paragraphs up to the first space
-- paragraphs using styles listed in the property used
-- paragraphs with no spaces are ignored set oldDelims to AppleScript's text item delimiters
tell application "InDesign 2.0.1"
set myStory to parent story of selection
set theLim to count of paragraphs of myStory
set topCount to 4
set secondCount to 1
set thirdCount to 1
repeat with n from 1 to theLim
set AppleScript's text item delimiters to {" "}
set myStyle to name of applied paragraph style of paragraph n of myStory
if myStyle is in thisStyle then
set theText to contents of paragraph n of myStory
set theParts to every text item of theText
if contents of item 1 of theParts is not equal to theText then
-- paragraph has at least one space
set AppleScript's text item delimiters to {"."}
set theLevel to count of text items of item 1 of theParts
if theLevel = 1 then
set word 1 of paragraph n of myStory to topCount as string
set topCount to topCount + 1
set secondCount to 1
set thirdCount to 1
else if theLevel = 2 then
set word 1 of paragraph n of myStory to (topCount - 1) as string
set word 2 of paragraph n of myStory to secondCount as string
set secondCount to secondCount + 1
set thirdCount to 1
else if theLevel = 3 then
set word 1 of paragraph n of myStory to (topCount - 1) as string
set word 2 of paragraph n of myStory to (secondCount - 1) as string
set word 3 of paragraph n of myStory to thirdCount as string
set thirdCount to thirdCount + 1
set CharStyle to bold
end if
end if
end if
end repeat
end tell
set AppleScript's text item delimiters to oldDelims
But not sure where to put it, sorry for taking up your time, and if you have no time at the moment no worrys.
Thanks
Adam
Technical Details
Message-ID:
<1de6d01c.16@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!c03.atl99!news.webusenet.com!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de6d01c.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,e7d83a70f4be8fa9 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-12-10 09:08:10 PST From: amjb <adam44@btopenworld.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!c03.atl99!news.webusenet.com!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Auto Numbering Message-ID: <1de6d01c.16@WebX.la2eafNXanI> Date: Tue, 10 Dec 2002 08:49:46 -0800 References: <1de6d01c.-1@WebX.la2eafNXanI> Lines: 60 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit