Article View: adobe.scripting.indesign
Article #866Re: Give #10 increment to each index entry folios....
From: thiyagus5
Date: Fri, 27 Feb 2009 09:50
Date: Fri, 27 Feb 2009 09:50
47 lines
2422 bytes
2422 bytes
Hi Dave,
I have done some modifications in the script according to our requirement with your script. Its working fine. I need help from you regarding searches between the range of numbers. For example in index i need to add numbers between the range 250 and 450. So the script has only find & add numbers, if the page numbers greater than 250 and Less than 450. Find the modified script below.
//To regenerate the Index numbers...
try
{
myIndex = app.selection[0].parentStory
}
catch(e)
{
alert ("Sorry! Place the cursor into the Story and then Try...")
exit();
}
//TO FIND ONLY BEGINING OF NUMBERS
setupFindGrep("\\<\\d+")
myFinds = myIndex.findGrep();
myVariable = prompt('Please the Enter Value: E.g. (2 or -2, 10 or -10)', '');
for (var j = myFinds.length - 1; j >= 0; j--) {
myFinds[j].contents = String(Number(myFinds[j].contents) + Number(myVariable))
}
function setupFindGrep(find, change, foots, hidLayers, lockedLayers, lockedStories, masters) {
app.findGrepPreferences = null;
app.changeGrepPreferences = null;
try { app.findGrepPreferences.findWhat = find } catch(e) {};
try {app.changeGrepPreferences.changeTo = change } catch(e) {};
app.findChangeGrepOptions.properties = {
includeFootnotes:(foots == null ? false : foots),
includeHiddenLayers:(hidLayers == null ? false : hidLayers),
includeLockedLayersForFind:(lockedLayers == null ? false : lockedLayers),
includeLockedStoriesForFind:(lockedStories == null ? false : lockedStories),
includeMasterPages:(masters == null ? false : masters)
}
} // end setupFindGrep
alert ("The Index has been Updated with (" + myVariable + ") Numbers...")
//End of sript
Can you please look into this and help me. Thanks in advance Dave.
Regards
Thiyagu
Technical Details
Message-ID:
<59b7c9a2.7@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossingReferences:
<59b7c9a2.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,51aaf7605a8cc21d X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: thiyagus5@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: Give #10 increment to each index entry folios.... Message-ID: <59b7c9a2.7@webcrossing.la2eafNXanI> Date: Fri, 27 Feb 2009 01:50:10 -0800 References: <59b7c9a2.-1@webcrossing.la2eafNXanI> Lines: 58 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit