Article View: adobe.scripting.indesign
Article #15441Re: Setting Applied Char Style of Nested Style by name
From: Dave_Saunders
Date: Fri, 28 Nov 2003 23:04
Date: Fri, 28 Nov 2003 23:04
19 lines
1595 bytes
1595 bytes
Hot damn! This works:
myDoc = app.documents[0];
myPstyles = myDoc.paragraphStyles;
myNstyles = myPstyles.item('Body').nestedStyles;
myNewNstyle = myNstyles.add();
for (i=(myNstyles.length - 1); i>0; i--) {
myNstyles.item(i).properties = myNstyles.item(i-1).properties;
}
myNstyles[0].appliedCharacterStyle = myDoc.characterStyles.item('Green');
myNstyles[0].delimiter = NestedStyleDelimiters.anyWord;
I added a nested style to the paragraph style 'Body', then, using the for loop, I shuffled the properties down one, then I set the two properties of the first style so that the first word would now be green. (the inclusive and repetition properties were already as I wanted them).
Not as convenient as adding the new style at the beginning of the list right off the bat, but not that much work that it's something to worry about.
Dave
Technical Details
Message-ID:
<2ccea3bf.8@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2ccea3bf.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,f6998017447264e4 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-11-28 15:07:38 PST From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: Setting Applied Char Style of Nested Style by name Message-ID: <2ccea3bf.8@webx.la2eafNXanI> Date: Fri, 28 Nov 2003 15:04:40 -0800 References: <2ccea3bf.-1@webx.la2eafNXanI> Lines: 25 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit