Adobe 26001360 Scripting Guide - Page 49
Working with selections, In Visual Basic
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 49 highlights
Adobe Illustrator CS Scripting Guide 49 In Visual Basic: Private Sub Command1_Click() 'Get reference for first page item of document 1 Dim appRef As New Illustrator.Application Dim documentRef As Illustrator.Document Dim pageItemRef As Illustrator.PageItem Set documentRef = appRef.ActiveDocument Set pageItemRef = documentRef.PageItems(1) End Sub In the scripts below, the variable pageItemRef will not necessarily refer to the same object as the above script since this script includes a reference to a layer: In AppleScript: -- Get reference for first page item of layer 1 of document 1 tell application "Adobe Illustrator CS" set pageItemRef to page item 1 of layer 1 of document 1 end tell In Visual Basic: Private Sub Command1_Click() 'Get reference for first page item of document 1 Dim appRef As New Illustrator.Application Dim documentRef As Illustrator.Document Dim pageItemRef As Object Set documentRef = appRef.ActiveDocument Set pageItemRef = documentRef.Layers(1).PageItems(1) End Sub Working with selections There are instances where you will want to write scripts that act upon the currently selected object(s). For example, you might want to have a script that applies formatting to selected text, or changes a selected path's shape. To do this, you need to know the number of selected objects and the type of each object. The following scripts work with the current selection. 12 Aug 03