Article View: adobe.scripting.indesign
Article #16307[AS] Changing Character Styles
From: Brent Hardinge
Date: Tue, 23 Sep 2003 23:48
Date: Tue, 23 Sep 2003 23:48
40 lines
2161 bytes
2161 bytes
I've been reading the forum titled "AS changing text attributes" (John Darnell "AS changing text attributes" 5/13/03 1:00pm </cgi-bin/webx?14@@.1de8dffa>) and have tried it myself to no avail.
I have modified the script to the following:
tell application "InDesign 2.0.2"
set find preferences to nothing
set change preferences to nothing
tell active document
set myCharacterStyle to character style "num"
repeat with myStory in stories
set myStartItems to search for "("
set myEndItems to search for ")"
if (count myStartItems) is not equal to (count myEndItems) then
display dialog "Oops. The text must include mismatched formatting. Good luck finding the offending tags!"
else
repeat with myCounter from 1 to (count myStartItems)
set myStartItem to object reference of item myCounter of myStartItems
set myEndItem to object reference of item myCounter of myEndItems
set myStartIndex to (index of character -1 of myStartItem) + 1
set myEndIndex to (index of character 1 of myEndItem) - 1
set applied character style of characters myStartItem through myEndItem of myStory to myCharacterStyle
end repeat
end if
end repeat
end tell
end tell
and am trying to search through a story with the following text:
Abuse (1010)
Adultery (1020)
AIDS (1030)
Alcohol (1040)
Amulets (1365)
Angels (1050)
Anger (1060)
Antichrist (1065)
Anxiety (3850)
Technical Details
Message-ID:
<2ccd846a.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!news.osn.de!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,d49137c2becb9af4,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-09-23 17:09:02 PST From: "Brent Hardinge" <brent@bibleinfo.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!news.osn.de!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: [AS] Changing Character Styles Message-ID: <2ccd846a.-1@webx.la2eafNXanI> Date: Tue, 23 Sep 2003 16:48:38 -0700 Lines: 45 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit