Copy link to clipboard
Copied
Hello There.
I am trying the following script from the Adobe CS6 Scripting Tutorial:
try{
myFont = app.fonts.item("Arial");
}
catch (myError){};
var myDocument = app.documents.item(0);
with(myDocument){
var myPage = pages.item(0);
var myBounds = myGetBounds(myPage,myDocument);
with(myDocument.pages.item(0)){
//Get a reference to the text frame.
var myTextFrame = textFrames.item(0);
//Change the size of the text frame.
myTextFrame.geometricBounds = myBounds;
var myParagraph = myTextFrame.paragraphs.item(0);
myParagraph.appliedFont = myFont;
myParagraph.justification = Justification.centerAlign;
myParagraph.pointSize = 48;
}
}
//myGetBounds is a function that returns the bounds
//of the "live area" of a page.
function myGetBounds(myDocument, myPage){
// line 28:
var myPageWidth = myDocument.documentPreferences.pageWidth;
var myPageHeight = myDocument.documentPreferences.pageHeight
if(myPage.side == PageSideOptions.leftHand){
var myX2 = myPage.marginPreferences.left;
var myX1 = myPage.marginPreferences.right;
}
else{
var myX1 = myPage.marginPreferences.left;
var myX2 = myPage.marginPreferences.right;
}
var myY1 = myPage.marginPreferences.top;
var myX2 = myPageWidth - myX2;
var myY2 = myPageHeight - myPage.marginPreferences.bottom;
return [myY1, myX1, myY2, myX2];
}
When I run it from the InDesign Scripts panel, I get the following:
Whats wrong?
Any help would be greatly appreciated.
Hi,
You have reversed arguments when you call the function myGetBounds
var myBounds = myGetBounds(myPage,myDocument);
function myGetBounds(myDocument, myPage)
Regards
Copy link to clipboard
Copied
Hi,
You have reversed arguments when you call the function myGetBounds
var myBounds = myGetBounds(myPage,myDocument);
function myGetBounds(myDocument, myPage)
Regards
Copy link to clipboard
Copied
I realized that. The script is copied-and-pasted from the "Adobe CS6 Scripting Tutorial" PDF. I tried reversing the arguments and when I ran the script from the ID script panel nothing happened (there was no indicationat all that it ran the script)
Copy link to clipboard
Copied
Well, did the frame fit the page dimensions?
Copy link to clipboard
Copied
Yes.Thank you for your help.
Note to all: "Adobe CS6 Scripting Tutorial" PDF has at least one error in their script. See the first post in this thread.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more