12.01.2013 Views

Adobe InDesign CS5 Scripting Tutorial

Adobe InDesign CS5 Scripting Tutorial

Adobe InDesign CS5 Scripting Tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Adobe</strong> <strong>InDesign</strong> <strong>CS5</strong> <strong>Scripting</strong> <strong>Tutorial</strong> Constructing a document 34<br />

AppleScript<br />

set myLeftPage to page 1 of myMasterSpread<br />

set myRightPage to page 2 of myMasterSpread<br />

tell myLeftPage<br />

set myLeftFooter to make text frame<br />

set geometric bounds of myLeftFooter to {728, 70, 742, 528}<br />

set first baseline offset of text frame preferences of myLeftFooter to leading<br />

offset<br />

set contents of myLeftFooter to auto page number<br />

set point size of character 1 of parent story of myLeftFooter to 11<br />

set leading of character 1 of myLeftFooter to 14<br />

end tell<br />

tell myRightPage<br />

set myRightFooter to make text frame<br />

set geometric bounds of myRightFooter to {728, 84, 742, 542}<br />

set first baseline offset of text frame preferences of myRightFooter to leading<br />

offset<br />

set contents of myRightFooter to auto page number<br />

set point size of character 1 of parent story of myRightFooter to 11<br />

set leading of character 1 of myRightFooter to 14<br />

set justification of character 1 of myRightFooter to right align<br />

end tell<br />

JavaScript<br />

var myMasterSpread = myDocument.masterSpreads.item(0);<br />

var myLeftPage = myMasterSpread.pages.item(0);<br />

var myRightPage = myMasterSpread.pages.item(1);<br />

var myLeftFooter = myLeftPage.textFrames.add();<br />

myLeftFooter.geometricBounds = [728, 70, 742, 528];<br />

myLeftFooter.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;<br />

myLeftFooter.contents = SpecialCharacters.autoPageNumber;<br />

myLeftFooter.parentStory.characters.item(0).pointSize = 11;<br />

myLeftFooter.parentStory.characters.item(0).leading = 14;<br />

var myRightFooter = myRightPage.textFrames.add();<br />

myRightFooter.geometricBounds = [728, 84, 742, 542];<br />

myRightFooter.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;<br />

myRightFooter.contents = SpecialCharacters.autoPageNumber;<br />

myRightFooter.parentStory.characters.item(0).pointSize = 11;<br />

myRightFooter.parentStory.characters.item(0).leading = 14;<br />

myRightFooter.parentStory.characters.item(0).justification =<br />

Justification.rightAlign;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!