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

paragraph --- hyperlink destination

Participant ,
May 31, 2019 May 31, 2019

Copy link to clipboard

Copied

How do I check the paragraph has hyperlink destination

TOPICS
Scripting

Views

481

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

Advocate , Jul 04, 2019 Jul 04, 2019

Hi priyak7746321​,

I digged a bit got this, you may give it a shot:

var myDoc = app.documents[0];

for(var pg = 0; pg < myDoc.pages.length; pg++){

    for(var tf = 0; tf < myDoc.pages[pg].textFrames.length; tf++){

        for(var p = 0; p < myDoc.pages[pg].textFrames[tf].paragraphs.length; p++){

            if(checkIfDestinationHyerlink(myDoc, myDoc.pages[pg].textFrames[tf].paragraphs

)){

                //Use it as per your need

                $.writeln("Destination hyperlink found in this para----");

  

...

Votes

Translate

Translate
Participant ,
May 31, 2019 May 31, 2019

Copy link to clipboard

Copied

I am going to add hyperlink for text. if the text has existing hyperlink destination how to validate. anyone please advice.

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 ,
Jul 04, 2019 Jul 04, 2019

Copy link to clipboard

Copied

LATEST

Hi priyak7746321​,

I digged a bit got this, you may give it a shot:

var myDoc = app.documents[0];

for(var pg = 0; pg < myDoc.pages.length; pg++){

    for(var tf = 0; tf < myDoc.pages[pg].textFrames.length; tf++){

        for(var p = 0; p < myDoc.pages[pg].textFrames[tf].paragraphs.length; p++){

            if(checkIfDestinationHyerlink(myDoc, myDoc.pages[pg].textFrames[tf].paragraphs

)){

                //Use it as per your need

                $.writeln("Destination hyperlink found in this para----");

                }

            else{

                $.writeln("No Destination hyperlink !");

                }

            }

        }

    }

//

function checkIfDestinationHyerlink(myDoc, myPara){

    for(var hd = 0; hd < myDoc.hyperlinkTextDestinations.length; hd++){

        if(myDoc.hyperlinkTextDestinations[hd].destinationText.paragraphs[0] == myPara){

            return true

            }

        }

    return false;

    }

Best

Sunil

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