Article View: adobe.scripting.indesign
Article #14923Re: (AS, CS) Relating page references to index subtopics
From: Peter_Kahrel
Date: Fri, 09 Jan 2004 15:03
Date: Fri, 09 Jan 2004 15:03
39 lines
1894 bytes
1894 bytes
I wrote this a few weeks ago, no reason why you should do the same. It marks all topics in all stories, and set to search case-insensitively and not for whole words, so maybe you want to change that (in its current form it overgenerates). And maybe try it out on dummy documents first. Feel free to modify it.
Peter
//DESCRIPTION: create page references from topics in document
app.findPreferences = null;
app.changePreferences=null;
app.changePreferences.changeText = "";
doc = app.activeDocument;
doctopics = app.activeDocument.indexes[0].index.topics;
if(doctopics.length > 0)
{
allstories = app.activeDocument.stories;
allstoriesL = allstories.length;
for( i = 0 ; i < allstoriesL ; i++)
onestory( allstories[i] );
}
else
{
alert("No topics in this document . . .");
exit()
}
function onestory( _story )
{
dt = doctopics.length;
for( t=0 ; t < dt ; t++)
{
t_instances = _story.search( doctopics[t].name , false , false , undefined );
t_instancesL = t_instances.length
for( j = t_instancesL-1 ; j > -1 ; j-- )
{
_offset = t_instances[j].index;
doc.indexes[0].index.topics[t].pageReferences.add( _story , _offset , PageReferenceType.currentPage);
}
}
}
Technical Details
Message-ID:
<2ccf3c88.4@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2ccf3c88.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,ee2b3c498d942059 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-09 07:07:54 PST From: Peter_Kahrel@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: (AS, CS) Relating page references to index subtopics Message-ID: <2ccf3c88.4@webx.la2eafNXanI> Date: Fri, 9 Jan 2004 07:03:49 -0800 References: <2ccf3c88.-1@webx.la2eafNXanI> Lines: 45 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit