Article View: adobe.scripting.indesign
Article #20118Re: AS vs. VB -- is one faster than the other?
From: Shane Stanley
Date: Fri, 01 Nov 2002 22:09
Date: Fri, 01 Nov 2002 22:09
35 lines
2188 bytes
2188 bytes
in article 1de668d0.4@WebX.la2eafNXanI, Jay Fraser wrote:
> It's my secondary machine, a Powerbook G3 running at 266 ... so I cut it some
> slack. <g> But the script is a bear, too: for some reason I haven't figured
> out yet, some spaces had character styling
> different than the surrounding text. I.e. in the name "John Doe", the words
> "John" and "Doe" would have character styling "Name", but the space between
> them would be styled "Address".
>
> That totally screwed up my various scripts. The only way I could think do fix
> that was to choose every space and give it the same style as the character
> before it. That's a lot of grinding.
Too much grinding. This might be a bit quicker:
tell application "InDesign 2.0.1"
tell document 1
repeat with i from 1 to count of stories
set theSpaces to (index of every text style range of story i whose
contents = " ")
repeat with j from 1 to (count of theSpaces)
set theNum to item j of theSpaces
if theNum > 1 then
set newText to contents of characters (theNum - 1) thru theNum of story
i
delete character theNum of story i
set contents of character (theNum - 1) of story i to newText
end if
end repeat
end repeat
end tell
en d tell
--
Shane Stanley, sstanley@myriad-com.com.au
Technical Details
Message-ID:
<B9E946DE.42D9D%sstanley@myriad-com.com.au>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!newsfeed.gamma.ru!Gamma.RU!newsfeed.sovam.com!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de668d0.-1@WebX.la2eafNXanI> <1de668d0.4@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,79fa738adeb65bd7 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-11-01 14:46:03 PST From: Shane Stanley <sstanley@myriad-com.com.au> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!newsfeed.gamma.ru!Gamma.RU!newsfeed.sovam.com!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: AS vs. VB -- is one faster than the other? Message-ID: <B9E946DE.42D9D%sstanley@myriad-com.com.au> Date: Fri, 1 Nov 2002 14:09:51 -0800 References: <1de668d0.-1@WebX.la2eafNXanI> <1de668d0.4@WebX.la2eafNXanI> Lines: 43 User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit