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

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

Contributor ,
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

227

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

Community Expert , 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.

Votes

Translate

Translate
Community Expert ,
Dec 30, 2021 Dec 30, 2021

Copy link to clipboard

Copied

Look into the Hyperlink panel.

Votes

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
Community Expert ,
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

Votes

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.

Votes

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
Community Expert ,
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)

Votes

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