Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Hyperlink Destination Characters

Participant ,
May 29, 2012 May 29, 2012

Hi,

I'm looking for a way to eliminate hyperlink destination characters (the blue colons) either with Javascript or via grep. The weird thing is that with the following grep:

(([[:punct:]]|[[:alnum:]]|[[:space:]])*)

…if you select the character on its own and search the selection, it says it's not found (as you'd hope). But if you search a paragraph using that grep, it skips over and includes it (even for a replace). This has to be a bug. So I could loop through each character invoking an InDesign-style find on that selection, but that's a bit of a pain and would be super slow.

ID's Javascript doesn't include POSIX support, so that's no good, and when I copy-paste the character in question into ID, it gives me

~l

which seems like it ought to work but is never found. This also seems like a probable bug.

Any ideas, anyone? Alternatively, the problem I'm trying to solve is: I have a chapter heading (say) with a hyperlink text destination (usually) at the start of it. I duplicate this using JS, and the text destination is also duplicated, and I want to kill it in the duplicated, but not the original version. Hope that makes sense - it's for a table of contents.

Cheers,

Alex

TOPICS
Scripting
728
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 29, 2012 May 29, 2012

Rather than battling with the character placeholders -- a battle you will surely loose, as it's not possible to copy them and still keep their functionality --, you should look into manipulating the hyperlink destinations themselves.

It's tricky stuff nevertheless. Look in the Object Model for clues: http://jongware.mit.edu/idcs5.5js_html/idcs5.5js/index_Hyperlinks%20Suite.html could be a good start.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 29, 2012 May 29, 2012
LATEST

Thanks for the response. In a perfect world, I wouldn't copy them at all: I want to duplicate the text of a paragraph minus the text anchor but can't find a way of doing it. At least when it's duplicated, it becomes a new anchor rather than some weird copied-by-reference thing.

Either way, I need to exclude them from duplication (in which case how can I find them to ignore them) or remove them afterwards (ditto). The only reliable way seems to be tediously going through the indexed position of the character in question against all the destinations, which is a bit of a drag. Something like (for one char - untested!)

// with one anchor selected

var char = app.selection[0];

var dests = app.activeDocument.hyperlinkTextDestinations;

for (var i = 0 ; i < dests.length ; i++) {

   if ((dests.destinationText.index == char.index) && (dests.destinationText.parent == char.parent)) {

   // delete char


   }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines