Help with java
- Subject: Help with java
- From: Pete Kincaid <email@hidden>
- Date: Fri, 01 Jul 2005 13:59:36 -0500
- Delivered-to: email@hidden
- Delivered-to: email@hidden
- User-agent: Microsoft-Entourage/11.1.0.040913
Hello, I am writing a applescript studio application. I have a javascript
file that extracts data about a folder of Indesign CS files.
This is that script
// LinkExport.js
//
myDoc = app.documents[0];
myDocName = myDoc.name.split(".indd")[0];
myTXT_File = myDocName + '.txt';
myDocref = myDocName
myPath = myDoc.filePath + "/";
myCreator = "R*ch";
myType = "TEXT";
myData = "link\tpage\twidth\t% vertical\t% horizontal\teff. PPI\tBox
Size\r";
myData1 = "";
theFiles = myDoc.links;
for (i = 0; i<theFiles.length;i ++ ) {
myBounds = theFiles[i].parent.geometricBounds;
myWidth = Math.round(myBounds[3]-myBounds[1]);
myScaleVert = Math.round(theFiles[i].parent.absoluteVerticalScale);
myScaleHori = Math.round(theFiles[i].parent.absoluteHorizontalScale);
myImagePath = theFiles[i].filePath;
//myspace = theFiles[i].space;
// WARNING if vertical scale is different to horizontal scale
if (myScaleVert != myScaleHori){
var myWarning = "x";
}
else {
var myWarning = "";
}
try {
myPPI = (theFiles[i].parent.effectivePpi);
}
catch (e) {
myPPI = 0;
}
myClass = theFiles[i].parent.parent.parent.constructor.name;
// image placed on page
if (myClass == "Page") {
myPage = theFiles[i].parent.parent.parent.name;
}
// image embedded
else if (myClass == "Character"){
myPage =
theFiles[i].parent.parent.parent.parentTextFrame.parent.name;
}
else {
try {
// image placed outside the pages
myPage = "Spread of " +
theFiles[i].parent.parent.parent.pages[0].name;
}
catch(e) {
// don't know the page where the image is placed
alert ("Class: " + myClass + "\r" + theFiles[i].name);
}
}
myData1 += myImagePath + "\t" + theFiles[i].name + "\t" + myPage + "\t"
+ myScaleVert + "\t" + myScaleHori + "\t" + myPPI + "\t" + myBounds + "\r";
//myData += "Document: " + myDocref + "\r" + "Images:" +"\r" +
theFiles[i].filePath + "\t" + theFiles[i].name + "\t" + myPage + "\t" +
myWidth + "\t" + myScaleVert + "\t" + myScaleHori + "\t" + myPPI + "\t" +
myBounds + "\r";
}
//myData2 = myData + "Document: " + myDocref + "\r" + myData1;
myData2 = myData1;
f = new File( myPath + "Data" );
f.open( 'w', myType, myCreator );
f.writeln( myData2 );
f.close();
I was wondering, how do I put this script into my applescript studio .nib
file. I want this script to be executed when I click on a button.
Hope I supplied the right info.
Thanks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.