-
1. Re: How to access the Index topics?
[Jongware] Sep 21, 2010 7:11 AM (in response to Praveen10)What have you got, so far?
-
2. Re: How to access the Index topics?
Praveen10 Sep 21, 2010 7:14 AM (in response to [Jongware])I've tried with below coding, it's showing like 'Undefined is not an object':
var myDoc = app.activeDocument;
var myIndex = myDoc.indexes[0];
var myTopic = myIndex.topics;
alert(myTopic.length);
Thanks,
Praveen
-
3. Re: How to access the Index topics?
[Jongware] Sep 21, 2010 7:50 AM (in response to Praveen10)Hmmm. So first thing to find out is what line fails.
var myDoc = app.activeDocument;
if (myDoc.indexes.length != 0) // Do we have any index at all? If not, no point in trying.
{
var myIndex = myDoc.indexes[0];var myTopic = myIndex.topics;
alert(myTopic.length);
}
Now hold on -- this fails when there is no index at all, but if I add even a single topic, it correctly shows "1" for myTopic.length. Are you sure you are trying on a file with an actual index?
This line at the end
alert(myTopic.everyItem().name.join("\r"));
correctly shows a list of every topic in the index.


