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

paragraph --- hyperlink destination

Participant ,
May 31, 2019 May 31, 2019

How do I check the paragraph has hyperlink destination

TOPICS
Scripting
602
Translate
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----");

  

...
Translate
Participant ,
May 31, 2019 May 31, 2019

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

Translate
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
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

Translate
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