Adobe 26001360 Scripting Guide - Page 41
Adding features to the AppleScript script, New in Script Editor
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 41 highlights
Adobe Illustrator CS Scripting Guide 41 3. Resize the text frame item to match the document's width. Adding features to the AppleScript script To create the enhanced script follow these steps: 1. Choose File > New in Script Editor to create a new script. 2. Enter the following code: tell application "Adobe Illustrator CS" -- current document is always the active document set docRef to the current document set docWidth to the width of docRef -- resize the text frame item to match the page width set width of text frame item 1 of docRef to docWidth -- alternatively, one can reference the item directly, as follows: set width of text frame item 1 of current document to docWidth end tell 3. Save the script. 4. Make sure you have the document created by the original "Hello World" script open, then run the script. Adding features to the Visual Basic script To create the enhanced script follow these steps: 1. Open the project you created for the "Hello World" script, if it's not already open. 2. Add a new button to the form. 3. Double-click the button to display the Code window, then enter the following code. Private Sub Command1_Click() Dim appRef As New Illustrator.Application Dim documentRef As Illustrator.Document Dim sampleText As Illustrator.TextFrameItem Dim documentWidth As Single ' Get the active document Set documentRef = appRef.ActiveDocument documentWidth = documentRef.Width Set sampleText = documentRef.TextFrameItems(1) 12 Aug 03