Article View: adobe.scripting.indesign
Article #1467Re: Extracting info from Links panel
From: Peter Kahrel
Date: Tue, 10 Feb 2009 20:16
Date: Tue, 10 Feb 2009 20:16
47 lines
2046 bytes
2046 bytes
Kris,
Here's the adapted script. I shamelessly copied a routine poted by Harbs (see <http://www.adobeforums.com/webx/.59b77ee3/6)> so that you get a link's page number no matter where it is.
Peter
f = new File ('~/coordinates.txt');
f.open ('w');
g = app.activeDocument.allGraphics;
for (i = 0; i < g.length; i++)
{
data = File (g[i].itemLink.filePath).name + '\t';
data += g[i].itemLink.parent.absoluteHorizontalScale + ',';
data += g[i].itemLink.parent.absoluteVerticalScale + '\t';
data += FindWhere (g[i].itemLink.parent.parent.parent).name;
f.writeln (data)
}
f.close();
function FindWhere (theObj,where)
{
var err;
if(where==undefined){where=Page}
if (theObj.hasOwnProperty("baseline"))
{
try{theObj = theObj.parentTextFrames[0];}
catch(err){}
}
while (theObj != undefined) {
var whatIsIt = theObj.constructor;
switch (whatIsIt) {
case where : return theObj;
case Note:
case Footnote: theObj = theObj.storyOffset;break;
case Character: theObj = theObj.parentTextFrames[0]; break;
case Cell: theObj = theObj.insertionPoints[0].parentTextFrames[0]; break;
case Application: return null;
}
if (theObj == undefined) return null;
theObj = theObj.parent;
}
return null;
}
Technical Details
Message-ID:
<59b7d3ce.6@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossingReferences:
<59b7d3ce.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,bd0091c62c2e8cba X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Peter Kahrel" <kahrel@kahrel.plus.com> Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: Extracting info from Links panel Message-ID: <59b7d3ce.6@webcrossing.la2eafNXanI> Date: Tue, 10 Feb 2009 12:16:29 -0800 References: <59b7d3ce.-1@webcrossing.la2eafNXanI> Lines: 57 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit