Adobe 26001360 Scripting Guide - Page 25
Conditional statements, Control structures, Visual Basic, AppleScript
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 25 highlights
Adobe Illustrator CS Scripting Guide 25 Visual Basic In Visual Basic, use the Add method to create new objects, the Set statement to assign object references to Visual Basic variables or properties, the assignment operator ( = ) to retrieve and change object properties. Conditional statements If you could speak to Illustrator in the course of a work session, you might say, "If the selected object is a path, then set its stroke width to 12 points." Conditional statements make decisions-they give your scripts a way to evaluate something (the color of the selected object, or the number of color swatches in the document, or the date) and then act according to the result. Most conditional statements start with the word if in both scripting systems. The following examples check the number of currently open documents. If no documents are open, the scripts display a messages in a dialog box. AppleScript tell application "Adobe Illustrator CS" activate set documentCount to count every document if documentCount = 0 then display dialog "No Illustrator documents are open!" end if end tell Visual Basic Private Sub Command1_Click() Dim documentCount as long Dim appRef As New Illustrator.Application documentCount = appRef.Documents.Count If documentCount = 0 then MsgBox "No Illustrator documents are open!" End If End Sub Control structures If you could talk to Illustrator, you might say, "Repeat the following procedure twenty times." In scripting terms, this sort of direction is called a "control structure." Control structures provide 12 Aug 03