Article View: adobe.scripting.indesign
Article #20490Apply character style to chosen characters? (AS)
From: Kari Puikkonen
Date: Wed, 03 Jul 2002 22:24
Date: Wed, 03 Jul 2002 22:24
53 lines
2160 bytes
2160 bytes
Hoo!
I would like to apply a predifined charcter style to chosen characters (in my case numbers/digits).
The following script changes the first found character, but how could I change all my found characters:
tell application "InDesign 2.0.1"
set find preferences to nothing
set change preferences to nothing
tell document 1
set myFoundItems to {}
set myFoundItems to search document 1 with find attributes {find text:"^9"}
repeat with myCounter from (count myFoundItems) to 1 by -1
set myFoundItem to item myCounter of myFoundItems
end repeat
set theStyle to character style "Time"
tell item 1 of myFoundItems
set applied character style to theStyle
end tell
end tell
end tell
I tried to change this line:
tell item 1 of myFoundItems
to
tell items 1 through -1 of myFoundItems
but got error.
I also tried this line:
tell (myFoundItems)
but got error.
Then I tried change this line:
set applied character style to theStyle
to
set applied character style of character myFoundItems of document 1 to character style "Time" of document 1
and to
repeat with i from 1 to count of myFoundItems
set applied character style of (every word of story i whose contents = myFoundItems) to theStyle
but got error
My instincts tell me that this can be done, so if somebody could advise me...
Thanks in advance!
Kari
Technical Details
Message-ID:
<ef97992.-1@WebX.aaQKaf7vad4>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!supernews.com!news.tele.dk!small.news.tele.dk!128.230.129.106!news.maxwell.syr.edu!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,e7eb9c0f57bd6ad2 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-07-03 15:39:50 PST From: "Kari Puikkonen" <kari.puikkonen@welho.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!supernews.com!news.tele.dk!small.news.tele.dk!128.230.129.106!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Apply character style to chosen characters? (AS) Message-ID: <ef97992.-1@WebX.aaQKaf7vad4> Date: Wed, 3 Jul 2002 15:24:20 -0700 Lines: 58 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit