Adobe 26001360 Scripting Guide - Page 453
Notes, Example 83.1
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 453 highlights
Adobe Illustrator CS Scripting Guide 453 Notes Tags allows you to assign an unlimited number of key-value pairs to any item in a document. Example 83.1 This example illustrates how to list the tags associated with the first selected item. The name and value of the tags are listed in a new document. Dim appRef As New Illustrator.Application Dim reportDocument As Illustrator.Document Dim selection As Variant Dim selectedArt As Object Dim tagList As Illustrator.Tags Dim tagItem As Illustrator.Tag Dim top_offset As Single selection = appRef.selection If (Not IsEmpty(selection)) Then 'Get the first selected item Set selectedArt = selection(0) Set tagList = selectedArt.Tags If (tagList.Count = 0) Then MsgBox "The selected art has no tags" Exit Sub End If 'Create a document and add a line of text per tag Set reportDocument = appRef.Documents.Add top_offset = 400 For Each tagItem In tagList Dim tagText As Illustrator.TextFrame Set tagText = reportDocument.TextFrames.Add tagText.Contents = "Tag: (" & tagItem.Name & " , " & tagItem.Value & ")" tagText.Position = Array(100, top_offset) top_offset = top_offset - 20 Next 12 Aug 03