Skip to main content
Participant
November 27, 2024
Question

Cleaning up Empty cross-reference markers

  • November 27, 2024
  • 3 replies
  • 316 views

I have an InDesign document that I am working with in CC 2014. It was originally converted from either Frame Maker (2007) or InDesign CS5 and seems to have some old cross-reference markers that are now estentially empty junk. The problem is that these don't show up in the cross-references or hyperlinks panel and so far I have now found a way to search for them - either through InDesign or with a script so I can delete them. They do read enough though to be able to mess up other scripts that I run that use the character count of the paragraph. Any ideas on how I can find and delete these without having to go one by one?

This topic has been closed for replies.

3 replies

Stefan Rakete
Inspiring
November 29, 2024

To show the number of HyperLinks and HyperLinkSources:

 

var curDoc = app.activeDocument;

var countHyperlinkTextDestinations = curDoc.hyperlinkTextDestinations.length;
var countHyperlinkTextSources = curDoc.hyperlinkTextSources.length;


alert(„Report Hyperlinks“ + „\r“ + „\r“ +
            „TextHyperlinkDestinations: „ + countHyperlinkTextDestinations + „\r“ +
            „TextHyperlinkSources: „ + countHyperlinkTextSources  );

 

If that is what you want to remove then use this script to remove:

 

var curDoc = app.activeDocument;

var countHyperlinkTextDestinations = curDoc.hyperlinkTextDestinations.length;
var countHyperlinkTextSources = curDoc.hyperlinkTextSources.length;

curDoc.hyperlinkTextDestinations.everyItem().remove();
curDoc.hyperlinkTextSources.everyItem().remove();

alert(„RemoveHyperlinks“ + „\r“ + 
            „Removed „ + countHyperlinkTextDestinations + „ TextHyperlinkDestinations\r“ +
            „Removed „ + countHyperlinkTextSources + „ TextHyperlinkSources\r“  );
​

 

Participant
November 27, 2024

Hi Mark,  Thank you very much for your fast reply. I can upload a sample file in the morning but meanwhile I wanted to answer you with more data. I user several scripts that utilizes InDesign's hyperlink desinition feature to embed a page number link - It basically creates the same thing as a cross-reference but without the massive lags that sometimes follow and allows other information to be generated from the link such as bibligraphies, glossaries, etc. So I have valid hyperlink destinations in my file that show up in the hyperlink desintations options part of the cross-references panel but not in the cross-references panel itself. The empty hyperlinks desintations don't show up in any panels and so far I have not been able to find them with a script either. 

m1b
Community Expert
Community Expert
November 27, 2024

No worries, it will be good to see the sample document. Are you a scripter? Have a look at any of the "hyperlink" properties of Document, eg. Document.HyperlinkPageDestinations.

m1b
Community Expert
Community Expert
November 27, 2024

Hi @KB_book dsn, can you please share an .indd document that has some of these empty cross reference markers?

 

Also, it might be good to know if there are also some valid cross-reference markers in the document (ie. that do appear in the cross-references panel).

- Mark