How can a script access all link properties?
I'm really glad to find this pool of expertise out in the cloud. TIA for all replies.
I'm looking for proper syntax to access the more detailed properties of graphic file links, such as the page# on which they appear and effective PPI. These are visible in the link window, but I cannot find them in the ESTK for CS4 Object Model Viewer. There is are name, filePath, and linkType, which are all very useful and also visible in the link window. But as for the other info I see only a suggestive attribute called "properties" which is itself an object, and I cannot seem to query its contents.
As I'm very, very new to scripting the cause could be little more than my own ignorance.
Is there a way to convert and object to strings so I can see how it is built?
In case anyone is interested, I'm trying to amplify a very helpful little script written three years ago by Steve Wareham:
// ====== 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
attempts to amplify with addition of Page and Effective PPP by Marc Shargel May 2010 */
// ----- 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 my1RadioButton = checkboxControls.add({staticLabel:"Names", checkedState:true});
var my2RadioButton = checkboxControls.add({staticLabel:"Paths"});
var my3RadioButton = checkboxControls.add({staticLabel:"File type"});
var my4RadioButton = checkboxControls.add({staticLabel:"Page"});
var my5RadioButton = checkboxControls.add({staticLabel:"Effective PPI"});
// extending the dialogue box was easy...
}
}
}
}
// ----- 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 (my1RadioButton.checkedState == true) {
myNewTextFrame.contents = ( myNewTextFrame.contents + "File: " + myDocument.links.item(i).name );
}
if (my1RadioButton.checkedState == true) {
myNewTextFrame.contents = ( myNewTextFrame.contents + " Path: " + myDocument.links.item(i).filePath );
}
if (my3RadioButton.checkedState == true) {
myNewTextFrame.contents = ( myNewTextFrame.contents + " Type: " + myDocument.links.item(i).linkType );
}
//... but the following lines do not work. I can refer to "myDocument.links.item(i).properties" but it is reported as an object.
//if (my4RadioButton.checkedState == true) {
//myNewTextFrame.contents = ( myNewTextFrame.contents + " Page#: " + myDocument.links.item(i).page );
//}
//if (my5RadioButton.checkedState == true) {
// myNewTextFrame.contents = ( myNewTextFrame.contents + " PPI: " + myDocument.links.item(i).effectivePPI );
//}
myNewTextFrame.contents = ( myNewTextFrame.contents + '\r' );
}
}
myDialog.destroy();
