Answered
Script to Extract hyperlinks from Indesign File with Page number
Anyone have any script to extract hyperlinks from Indesign File with location (i.e with page number)
Anyone have any script to extract hyperlinks from Indesign File with location (i.e with page number)
Try the following
var list = [];
for (a=0; a<app.activeDocument.hyperlinks.length; a++)
{
try
{
d = app.activeDocument.hyperlinks[a].destination.destinationURL;
if (d.match(/^http/))
{
var b = app.activeDocument.hyperlinks[a].source
var page
if(b.constructor.name == "HyperlinkPageItemSource")
page = b.sourcePageItem.parentPage.name
else if(b.constructor.name == "HyperlinkTextSource")
page = b.sourceText.parentTextFrames[0].parentPage.name
$.writeln(page)
list.push ("Page Name " + page + " " + d);
}
} catch(_) {}
}
// show the list
alert ('All links:\r'+list.join('\r'));
// save the list as a file
listFile = new File(Folder.myDocuments+"/all_links.txt");
if (listFile.open("w"))
{
listFile.writeln(list.join('\n'));
listFile.close();
listFile.execute();
}
-Manan
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.