Adobe 65009333 Scripting Guide - Page 10
Walking through the script, Scripting terminology and the InCopy object model, Scripting terminology
UPC - 883919155852
View all Adobe 65009333 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 10 highlights
Getting Started Scripting terminology and the InCopy object model 10 Walking through the script This section presents a step-by-step analysis of what the script above does. 1. Establish communication with the InCopy application object: Refer to the application as app. 2. Create a new document and a reference to the document: Var myDocument = app.documents.add(); 3. Get a reference to the first story in the document (a standalone document always contains a story): var myStory = myDocument.stories.item(0); 4. Add text to the story by setting the contents property to a string. myStory.contents = "Hello World!"; Scripting terminology and the InCopy object model Now that you created your first InCopy script, it is time to learn more about the terminology of scripting languages in general and InCopy scripting in particular. Scripting terminology First, let's review a few common scripting terms and concepts. Comments Comments give you a way to add descriptive text to a script. The scripting system ignores comments as the script executes; this prevents comments from producing errors when you run your script. Comments are useful when you want to document the operation of a script (for yourself or someone else). In this document, we use comments in the tutorial scripts. To include a comment in JavaScript, type // to the left of the comment, or surround the comment with /* and */. For example: // this is a comment /* and so is this */ Values The point size of a text character, the contents of a note, and the filename of a document are examples of values used in InCopy scripting. Values are the data your scripts use to do their work. The type of a value defines what sort of data the value contains. For example, the value type of the contents of a word is a text string; the value type of the leading of a paragraph is a number. Usually, the values used in scripts are numbers or text. The following table explains the value types most commonly used in InCopy scripting: