Adobe InDesign CS5 Scripting Tutorial
Adobe InDesign CS5 Scripting Tutorial
Adobe InDesign CS5 Scripting Tutorial
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Adobe</strong> <strong>InDesign</strong> <strong>CS5</strong> <strong>Scripting</strong> <strong>Tutorial</strong> Adding features to “Hello World” 25<br />
Override Meaning Example<br />
p Picas (add points after the p, if necessary) 1p6<br />
pt Points 18pt<br />
Adding features to “Hello World”<br />
Next, we create a new script that makes changes to the “Hello World” publication that we created with our<br />
first script. Our second script demonstrates how to do the following:<br />
� Get the active document.<br />
� Use a function (or handler in AppleScript).<br />
� Get the page dimensions and page margins of the active document.<br />
� Resize a text frame.<br />
� Change the formatting of the text in the text frame.<br />
AppleScript<br />
Make sure you have the Hello World document open—this script relies on objects we created in that<br />
script. If you closed the document without saving it, simply run the HelloWorld.applescript script<br />
again to make a new document.<br />
Either open the ImprovedHelloWorld.applescript tutorial script, or perform the following steps to<br />
create the script:<br />
1. In the Script Editor, choose File > New to create a new script.<br />
2. Enter the following code:<br />
--Improved "Hello World"<br />
tell application "<strong>Adobe</strong> <strong>InDesign</strong> <strong>CS5</strong>"<br />
--Get a reference to a font.<br />
try<br />
--Enter the name of a font on your system, if necessary.<br />
set myFont to font "Helvetica"<br />
end try<br />
--Get the active document and assign<br />
--the result to the variable "myDocument."<br />
set myDocument to document 1<br />
tell myDocument<br />
--Use the handler "myGetBounds" to get the bounds of the<br />
--"live area" inside the margins of page 1.<br />
set myBounds to my myGetBounds(myDocument, page 1)