🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #17677

Re: AS - character style to part of text

#17677
From: Jay Fraser
Date: Thu, 22 May 2003 15:41
31 lines
1809 bytes
Fernando --

I tried answering a couple of time yesterday, but I always got interrupted before I could make the answer make any sense.

Here are some lines of script that might help:



tell application "InDesign 2.0.2" 
    set myTab to tab 
    tell active document 
        set myAddrStyle to character style "Address no." 
        repeat with j from 1 to (count stories) 
            repeat with i from 1 to (count paragraphs in story j) 
                try 
                    set applied character style of text from (character 1 whose contents = myTab) to character -1 of paragraph i of story j to myAddrStyle 
                end try 
            end repeat 
        end repeat 
    end tell 
end tell



this changes all the text after a tab on all paras to "Address no." The "try" and "end try" lines allow the script to deal with lines that don't have a tab.

I don't know why I have to "set myTab to tab", but it doesn't seem to work otherwise.

Hope this helps.

Jay
Technical Details
Message-ID: <1de9362f.2@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de9362f.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,241a499cbd123cfa
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-05-22 09:09:25 PST
From: "Jay Fraser" <jayfraser@yahoo.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!xmission!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: AS - character style to part of text
Message-ID: <1de9362f.2@WebX.la2eafNXanI>
Date: Thu, 22 May 2003 08:41:26 -0700
References: <1de9362f.-1@WebX.la2eafNXanI>
Lines: 33
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit