Adobe 26001360 - Illustrator CS - PC Manual page 308

Scripting guide
Hide thumbs Also See for 26001360 - Illustrator CS - PC:
Table of Contents

Advertisement

308
Example 8.1
This example demonstrates how to select all of the paths in a document that are not part of a
compound path or a group by testing the type of the Parent property with a TypeName
function.
Dim appRef As New Illustrator.Application
Dim pathArt As Illustrator.PathItem
If appRef.Documents.Count > 0 Then
If appRef.ActiveDocument.PathItems.Count > 0 Then
For Each pathArt In appRef.ActiveDocument.PathItems
If (Not TypeName(pathArt.Parent) = "CompoundPathItem") Then _
pathArt.Selected = True
Next
End If
End If
Example 8.2
This example demonstrates how to create a new compound path containing three
PathItems. The example then modifies the stroke of the paths in the compound path. Note
that when you modify the properties of a PathItem inside a compound path you affect all
paths contained in the compound path. The example also shows how to access swatches in a
document by name.
Dim appRef As New Illustrator.Application
Dim frontDocument As Illustrator.Document
Dim activeLayer As Illustrator.Layer
Dim newCompoundPath As Illustrator.CompoundPathItem
Dim newPath As Illustrator.PathItem
Set frontDocument = appRef.ActiveDocument
Set activeLayer = frontDocument.activeLayer
Set newCompoundPath = activeLayer.CompoundPathItems.Add
'Create the path items
Set newPath = newCompoundPath.PathItems.Add
newPath.SetEntirePath Array(Array(30, 50), Array(30, 100))
Set newPath = newCompoundPath.PathItems.Add
newPath.SetEntirePath Array(Array(40, 100), Array(100, 100))
Set newPath = newCompoundPath.PathItems.Add
newPath.SetEntirePath Array(Array(100, 110), Array(100, 300))
12 Aug 03
Visual Basic Reference

Advertisement

Table of Contents
loading

This manual is also suitable for:

Illustrator cs

Table of Contents