Article View: adobe.scripting.indesign
Article #15005Re: (AS, CS) Relating page references to index subtopics
From: Peter_Kahrel
Date: Thu, 08 Jan 2004 21:07
Date: Thu, 08 Jan 2004 21:07
30 lines
1750 bytes
1750 bytes
Cris,
I don't know about Applescript, but in Javascript it would work like this. Suppose you have the following topics:
dog
border collie
mastiff
poodle
monkey
then with the following code, step through the JS debugger:
doc = app.activeDocument;
doctopics = app.activeDocument.indexes[0].topics;
_story = app.selection[0].parentStory;
If you then type the following code in the debugger's console, line by line, it returns the values in round brackets:
doctopics[0].subtopics[0].name (dog)
doctopics[1].subtopics[1].name (border collie)
doctopics[2].subtopics[1].name (mastiff)
doctopics[3].subtopics[1].name (poodle)
doctopics[4] (monkey)
It turns out that in the pageReferences.add()function you can't specify subtopics, and there's no need. You specify main topics and JS picks the lowest possible subtopic to flag with a page reference. So the following line marks an occurrence of "border collie":
//get a value for _index
doc.indexes[0].topics[1].pageReferences.add( _story , _index , PageReferenceType.currentPage);
Peter
Technical Details
Message-ID:
<2ccf3c88.2@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!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-08 13:07:49 PST From: Peter_Kahrel@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!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.2@webx.la2eafNXanI> Date: Thu, 8 Jan 2004 13:07:14 -0800 References: <2ccf3c88.-1@webx.la2eafNXanI> Lines: 36 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit