Adobe 65009333 Scripting Guide - Page 17
Adding features to “Hello World
UPC - 883919155852
View all Adobe 65009333 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 17 highlights
Getting Started Adding features to "Hello World" 17 "1p6," is returned as "1.5." InCopy does this because your scripting system would have trouble trying to perform arithmetic operations using measurement strings. For instance, trying to add "0p3.5" to "13p4" produces a script error, while adding .2916 to 13.333 (the converted pica measurements) does not. If your script depends on adding, subtracting, multiplying, or dividing specific measurement values, you might want to set the corresponding measurement units at the beginning of the script. At the end of the script, you can set the measurement units back to whatever they were before you ran the script. Alternately, you can use measurement overrides, like many of the sample scripts. A measurement override is a string containing a special character, as shown in the following table: Override p pt mm cm c i (or in) Meaning picas (add points after the p, if necessary) points millimeters centimeters ciceros (add didots after the c, if necessary) inches Example 1p6 18pt 6.35mm .635cm 1.4c .25i Adding features to "Hello World" Next, we create a new script that makes changes to the "Hello World" publication we created with our first script. Our second script demonstrates how to do the following: ➤ Get the active document. ➤ Change the formatting of the text in the first story. ➤ Add a note. Either open the ImprovedHelloWorld tutorial script or follow these steps to create the script: 1. Make sure you have the document you created earlier open. If you closed the document without saving it, simply run the HelloWorld.jsx script again to make a new document. 2. Enter the following JavaScript in a new text file: