Article View: adobe.scripting.indesign
Article #17198Re: (AS) OT fractions feature?
From: Jay Fraser
Date: Mon, 23 Jun 2003 23:12
Date: Mon, 23 Jun 2003 23:12
99 lines
3066 bytes
3066 bytes
Eric --
This one's a bit better: it skips the para if there aren't any parens; it turns the para blue if there is no open pare, green if there is no close paren, and pink if there is some other problem.
tell application "InDesign 2.0.2"
set myDocument to active document
tell myDocument
set myPink to swatch "C=0 M=100 Y=0 K=0"
set myBlue to swatch "C=100 M=0 Y=0 K=0"
set myGreen to swatch "C=75 M=5 Y=100 K=0"
set myStyle to character style "Emphasis"
set myOpenParen to ""
set myCloseParen to ""
set myStory to object reference of parent story of selection
tell myStory
repeat with i from (count paragraphs) to 1 by -1
try
try
set myOpenParen to index of (character 1 whose contents = "(") of paragraph i
on error
set myOpenParen to ""
end try
try
set myCloseParen to index of (character 1 whose contents = ")") of paragraph i
on error
set myCloseParen to ""
end try
if myOpenParen is not equal to "" and myCloseParen is not equal to "" then
set applied character style of characters myOpenParen thru myCloseParen to myStyle
set contents of character myCloseParen to ""
set contents of character myOpenParen to ""
end if
if myOpenParen is equal to "" and myCloseParen is not equal to "" then
set fill color of text of paragraph i to myBlue -- error w/ Open Paren
end if
if myOpenParen is not equal to "" and myCloseParen is equal to "" then
set fill color of text of paragraph i to myGreen -- error w/ Close Paren
end if
on error
set fill color of text of paragraph i to myPink -- general error w/ para
end try
end repeat
end tell
end tell
end tell
Technical Details
Message-ID:
<1de9a683.5@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de9a683.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,f332520123d2c8c6 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-06-23 16:37:54 PST From: "Jay Fraser" <jayfraser@yahoo.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: (AS) OT fractions feature? Message-ID: <1de9a683.5@WebX.la2eafNXanI> Date: Mon, 23 Jun 2003 16:12:03 -0700 References: <1de9a683.-1@WebX.la2eafNXanI> Lines: 62 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit