How to validate whether Hyperlink already present or not in Indesign using Javascript?

Participant ,
Dec 29, 2021 Dec 29, 2021

Copy link to clipboard

Copied

Is there any way to validate the Hyperlinks already added in the indesign document.

TOPICS
How to , Scripting

Views

125

Likes

Translate

Translate

Report

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

correct answers 1 Correct answer

Adobe Community Professional , Dec 30, 2021 Dec 30, 2021
Hi, Below is the snippet that will help you to tell whether hyperlink exists or not. var doc = app.activeDocument; var _hyperLink = doc.hyperlinks.itemByName('test'); if(_hyperLink.isValid) alert("Exists"); else alert("Not exists"); Assuming, hyperlink with name "test" exists in teh indesig document.

Likes

Translate

Translate
Adobe Community Professional ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

Look into the Hyperlink panel.

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

Hi,

Below is the snippet that will help you to tell whether hyperlink exists or not.

var doc = app.activeDocument;
var _hyperLink = doc.hyperlinks.itemByName('test');
if(_hyperLink.isValid)
    alert("Exists");
else
    alert("Not exists");

 

Assuming, hyperlink with name "test" exists in teh indesig document.

Best regards

Likes

Translate

Translate

Report

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
Advocate ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

LATEST

This would do the trick.

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

Can you be more specific? If you want to check if a block of Text has hyperlinks, you can use myText.findHyperlinks(), which will return an array of all hyperlinks in that text (array length can be 0)

Likes

Translate

Translate

Report

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