Discussion:
ID2 Script / Method for Deleting all Index Entries Needed
(too old to reply)
P***@adobeforums.com
2008-10-22 14:34:48 UTC
Permalink
Hi there,

I am looking for a way to remove all of the index entries from an InDesign 2.0.1 document.

I guess that I need a script, but I can't find one for ID2.

Any help gratefully received.

Best Regards,

Paul.
P***@adobeforums.com
2008-10-22 15:55:43 UTC
Permalink
Doesn't opening the index palette and deleting everything work?
P***@adobeforums.com
2008-10-23 09:10:45 UTC
Permalink
Yes - but you have to delete each entry individually.

I have a lot of entries (over 1000) and would like to delete them all in one go.
F***@adobeforums.com
2008-10-23 13:14:06 UTC
Permalink
This only goes one level deep. Let me know if you need it to go further.

myDoc = app.activeDocument
for (var j = 0;myDoc.indexes[0].topics.length < j;j++){
for (var k = 0;myDoc.indexes[0].topics[j].pageReferences.length<j;j++){
myDoc.indexes[0].topics[j].pageReferences[k].remove()
}
}
P***@adobeforums.com
2008-10-23 13:18:51 UTC
Permalink
Fred,

For ID2 it needs to be VBscript, I believe.

Peter
P***@adobeforums.com
2008-10-23 14:56:17 UTC
Permalink
Fred,

Thanks very much for your response. I only need to go one level deep.

I assume that I need to create a file with that code in and then put that in InDesign's Scripts folder.

With regard to Peter's post, what file extension will I need to give the file?

Thanks very much,

Paul.
F***@adobeforums.com
2008-10-23 15:39:15 UTC
Permalink
You can try it with a .js extension, however if Peter is correct I am afraid it won't work and I can't help you. You might want to try the scripting forum.
P***@adobeforums.com
2008-10-23 16:04:20 UTC
Permalink
I'm fairly certain javascript support wasn't added until CS, but it wouldn't hurt to try.

If you go over to the scripting forum you might want to link back here so they can see what Fred wrote. It might make it easier to translate (though I doubt if those guys need help :) ). I know Robin is still writing VBscript, and he may even pop in here, eventually -- not sure what time it is in Poland.

Peter
Robert Tkaczyk
2008-10-24 00:47:24 UTC
Permalink
thanks Peter ;)

Paul - save as "DeleteIndexEntries.VBS" to InDesign Scripts directory
I can't check it now - I'm not on my computer - but it should work
and it should delete all indexes ;)
and it should work with ALL versions of InDesign ;)

Dim myInDi
Dim myDoc
Dim a
Dim b
Dim i

Set myInDi=CreateObject("InDesign.Application")
Set myDoc=myInDi.ActiveDocument

For i = myDoc.Indexes.Count To 1 Step -1
For a = myDoc.Indexes.Item(i).Topics.Count To 1 Step -1
For b = myDoc.Indexes.Item(i).Topics.Item(a).PageReferences.Count To 1 Step -1
Call myDoc.Indexes.Item(i).Topics.Item(a).PageReferences.Item(b).Delete
Next
Call myDoc.Indexes.Item(i).Topics.Item(a).Delete
' remove above line if something go wrong
Next
Call myDoc.Indexes.Item(i).Delete
' remove above line if something go wrong
Next

robin
--
www.adobescripts.com
D***@adobeforums.com
2008-10-23 17:44:34 UTC
Permalink
CS is the oldest version of InDesign that supports JavaScript.

Dave
P***@adobeforums.com
2008-10-24 08:17:02 UTC
Permalink
Fred, Peter and Robert,

Thanks very much for all your help. Robert's VBScript did the trick and worked just fine.

Cheers,

Paul.

Loading...