// ====== ListLinks ====== \\ /* This is a JavaScript for InDesign. It will create a new text box on the first page of your document, and list all the links used in your document. A dialog box provides options to list the links names, files paths, and file types. Created by Steve Wareham 5/08/2007 */ // ----- Dialog Box ------\\ var myDialog = app.dialogs.add({name:"Link Lister", canCancel:true}); with(myDialog){ with(dialogColumns.add()){ with(borderPanels.add()){ } with(borderPanels.add()){ staticTexts.add({staticLabel:"What link information do you want? "}); } with(dialogColumns.add()){ with(borderPanels.add()){ var myLeftRadioButton = checkboxControls.add({staticLabel:"Names", checkedState:true}); var myCenterRadioButton = checkboxControls.add({staticLabel:"Paths"}); var myRightRadioButton = checkboxControls.add({staticLabel:"File type"}); } } } } // ----- End of Dialog Box ----- \\ //----- Begin ----- \\ if(myDialog.show() == true){ var myDocument = app.activeDocument; var totalLinks = myDocument.links.length; var myNewTextFrame = myDocument.textFrames.add() // Add a text frame to display the list of links myNewTextFrame.geometricBounds = [ "0p0", "0p0", "50p5", "50p5"]; for ( i = 0; i < totalLinks; i++ ) { if (myLeftRadioButton.checkedState == true) { myNewTextFrame.contents = ( myNewTextFrame.contents + "File: " + myDocument.links.item(i).name ); } if (myCenterRadioButton.checkedState == true) { myNewTextFrame.contents = ( myNewTextFrame.contents + " Path: " + myDocument.links.item(i).filePath ); } if (myRightRadioButton.checkedState == true) { myNewTextFrame.contents = ( myNewTextFrame.contents + " Type: " + myDocument.links.item(i).linkType ); } myNewTextFrame.contents = ( myNewTextFrame.contents + '\r' ); } } myDialog.destroy();