Copy link to clipboard
Copied
Hi guys,
(using a new account, for the time being, until my "real" one is being fixed by Adobe)
I'm into a new script to create/ manage Xrefs via tagged texts and I'm floored to see that F/C (grep tab obviously) seems not being able to find Anchors text (~I in grep)
- A copy/ paste form a textframe into the F/C does show the correct character, nicely saying that it should be possible to find it.
I'm assuming I do something wrong. @Peter Kahrel did create a script to manage Text anchors (https://creativepro.com/files/kahrel/indesign/text_anchors.html) so it's definitely possible to do something about them via script.
But what about via F/C?
Any experience on the matter guys?
Thanks for your lights
PS: Why I'm asking?
Because I'd like to check/ remove conditionnal text that may be applied on them. It'll be simple enough via F/C window.
Depends on what kind of anchors you mean. I think you can search for anchors just fine with the Find/Change dialog, both in the regular Text tab as well as the GREP tab. Use ~a to find an anchor. That's the marker for an anchored object. ~I is an index marker. If I make an actual index marker with InDesign's Index panel, it looks like this:
and ~I will find it in the F/C dialog. I don't know how effectively you can change it with the F/C dialog, but that's how it is findable. This one, ho
...Joel is spot-on. My script looks for all text anchors (hyperlinkTextDestinations for JavaScript) -- that's the easy part. But the anchors don't tell you what they're used for, so you have to bend over backwards to find whether they's used for cross-references, hyperlinks, bookmarks, or whatever.
Using the F/C window is useless: you can look for <FEFF> but you can't do anything with what you found. A script thinks that though what you find has length 1, it has no content.
I don't know in what
...Copy link to clipboard
Copied
Depends on what kind of anchors you mean. I think you can search for anchors just fine with the Find/Change dialog, both in the regular Text tab as well as the GREP tab. Use ~a to find an anchor. That's the marker for an anchored object. ~I is an index marker. If I make an actual index marker with InDesign's Index panel, it looks like this:
and ~I will find it in the F/C dialog. I don't know how effectively you can change it with the F/C dialog, but that's how it is findable. This one, however - this marker with the invisible character that looks like a colon, which is in this case a hyperlink destination - you can't find with ~I:
That's what you're looking for, right? A text anchor can do a few different things all covered by Peter's script. A look at the source seems to indicate that he finds all of these text anchors by finding all of the possible things they can be - the script doesn't search the text for thingies, it makes lists of all of the possible hyperlink text sources, all of the possible hyperlink page sources, and, all of the possible cross-reference sources. If that's what you need to do, that's one possible solution.
From the other direction, I think you can search the text for <ffef> which is the Unicode value for the marker. Interestingly enough, you cannot search with GREP for \x{ffef} - instead you have to use the Text tab of the F/C dialog and search for <ffef>. This will find all of the index markers, hyperlink text sources, xref sources, and zero-width spaces in your document. Accordingly I would suggest that you avoid the use of Change All as a result.
Copy link to clipboard
Copied
Thanks @Joel Cherney for your insight,
You're right, this is the mark I was looking for.
Sounds like F/C is not much helpfull here then. I've decided to go for script handling. It works now. All good. Thank you very much for the time spent and the support. Very helpful ^^
Copy link to clipboard
Copied
Joel is spot-on. My script looks for all text anchors (hyperlinkTextDestinations for JavaScript) -- that's the easy part. But the anchors don't tell you what they're used for, so you have to bend over backwards to find whether they's used for cross-references, hyperlinks, bookmarks, or whatever.
Using the F/C window is useless: you can look for <FEFF> but you can't do anything with what you found. A script thinks that though what you find has length 1, it has no content.
I don't know in what way you want to manage ankers and cross-refs, but to find all text anchors that are part of cross-references, you should collect all hyperlinks, then get those whose destinations are a HyperlinkTextDestination and whose source is a CrossReferenceSources. Along these lines:
hlinks = app.activeDocument.hyperlinks.everyItem().getElements();
for (i = 0; i < hlinks.length; i++) {
if (hlinks[i].destination instanceof HyperlinkTextDestination
&& hlinks[i].source instanceof CrossReferenceSource) {
// Your custom function
doSomethingWithTextAnchor (hlinks[i].destination);
}
}
Copy link to clipboard
Copied
Hey Peter,
Thanks for jumping in and for the provided code. Used it, expanded it to my need and it solves now issue
I needed to do something about text anchors because of a script I'm working on that helps create Xrefs from tagged text. It basically gathers all instances of 2 specific chains of characters (Destination and Links chains, inspired by Kazyan's approach here http://kasyan.ho.ua/indesign/hyperlink/x_references.html).
I'm using conditionnal text to show/ hide / help perform some actions on the tagged text. The issue is that, at this stage of development, the added text anchor gets the conditionnal text too, making the text anchors disapear if I hide the tagged text. It creates then an ugly "TM" feedback in the Xrefs panel on the link.
Thanks to your help, I made a script that remove all conditionnal text from all anchors. All good then, Thank you very much (again) ^^
Find more inspiration, events, and resources on the new Adobe Community
Explore Now