Copy link to clipboard
Copied
Hello again,
Is there a way in a paragraph style (via GREP?) to insert a character style to any text that receives a hyperlink?
Thanks in advance.
J.
You don't need any Grep. When you create a hyperlink you can set a character style in the interface:
And when you create a hyperlink in a script, you can apply a character style when you create the hyperlink source.
> Is there a way to apply a character style automatically depending on what type of hyperlink it is?
You'd need a script for that. Which type of hyperink do you want the character style applied to?
Copy link to clipboard
Copied
You don't need any Grep. When you create a hyperlink you can set a character style in the interface:
And when you create a hyperlink in a script, you can apply a character style when you create the hyperlink source.
Copy link to clipboard
Copied
Right, maybe I should rephrase then, sorry. I have paragraphs that contain many links, some in-page hyperlinks, some external url hyperlinks. Is there a way to apply a character style automatically depending on what type ofhyperlink it is?
Copy link to clipboard
Copied
> Is there a way to apply a character style automatically depending on what type of hyperlink it is?
You'd need a script for that. Which type of hyperink do you want the character style applied to?
Copy link to clipboard
Copied
Hi @JonathanJacqu28834810rfuu:
InDesign can do that for you without GREP as you add your URLs.
~Barb
Copy link to clipboard
Copied
LOL Peter: you beat me by 7 seconds! 😂
Copy link to clipboard
Copied
If you want to apply the character style to all link sources that are not page items, it's easy:
cstyle = app.documents[0].characterStyles.item ('myStyle');
sources = app.documents[0].hyperlinkTextSources.everyItem().getElements();
for (i = sources.length-1; i >= 0; i--) {
s[i].appliedCharacterStyle = cstyle;
}
because it targets all hyperlink text sources. But if it should be restricted to e.g. URL sources, it gets more complicated.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now