Recently while working on a dynamic template I noticed that things had got a little out of control on the Bookmark front and InDesign was crashing while trying to display the Bookmarks window. Subsequently found that this was because through the course of constantly updating the table of contents I had amassed over 75,000 bookmarks!

Something was needed, so I wrote a small JavaScript for InDesign to systematically remove them all.

function main () {
    var mybookmarks =app.documents[0].bookmarks.everyItem();
    var mybookmarkslen =app.documents[0].bookmarks.length;
    alert("Deleting " + mybookmarkslen + " bookmarks from document.");
    for (var i = 0; i < mybookmarkslen; i++) {

Working with scripts in InDesign

Scripts can invariably be found in a number of places, or indeed written yourself. In order to get them working within InDesign you need to place them in the ‘User’ scripts folder (which will vary in location). There’s a useful resource available if you need to understand this process a little better which can be found here.