Article View: adobe.scripting.indesign
Article #9648Re: JS CS2 Find/Change query
From: Peter_Kahrel
Date: Wed, 16 Aug 2006 06:21
Date: Wed, 16 Aug 2006 06:21
23 lines
1313 bytes
1313 bytes
You can't do this with find/change: you'll have to use just find, then process the collection of found objects.
It's probably easiest to do it in two passes. Collect all description paragraphs containing ' and ' using search much in the way you do now:
myFindAction = myStory.search(' and ', true, true, '', {appliedParagraphStyle:myFind});
Then change each found paragraph's preceding paragraph by adding an 's':
for( var i = 0; i < myFindAction.length; i++ )
{
var prevPar = myStory.paragraphs.previousItem( myFindAction[i].paragraphs[0] )
prevPar.insertionPoints[-2].contents = 's'
}
Repeat for comma. There are several other possibilities, this is just one.
Peter
Technical Details
Message-ID:
<3bc146f3.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossingReferences:
<3bc146f3.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,7b7786914afaf3c,start X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Peter_Kahrel@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Re: JS CS2 Find/Change query Message-ID: <3bc146f3.0@webcrossing.la2eafNXanI> Date: Tue, 15 Aug 2006 23:21:39 -0700 References: <3bc146f3.-1@webcrossing.la2eafNXanI> Lines: 22 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing