Adobe 26001360 Scripting Guide - Page 32
capabilities to your script. The following examples show how to how you can stop a script
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 32 highlights
32 About error handling capabilities to your script. The following examples show how to how you can stop a script from executing when a specific file cannot be found. AppleScript --Store a reference to the fifth path item of the document in a variable --If the object does not exist in the current document, display a message tell application "Adobe Illustrator CS" activate try set itemCount to count of path items in current document set fifthItem to path item 5 of current document on error display dialog "Couldn't locate 5th path object - Only " ¬ & itemCount & " objects." end try end tell Visual Basic Private Sub Command1_Click() ' Store a reference to the fifth path item of the document in a ' variable. If the object does not exist in the current document, ' display message. Dim appRef As New Illustrator.Application Dim docRef As Illustrator.Document Dim aiObject As Illustrator.PathItem Dim numObjects As Single Dim errorMessage As String Set docRef = appRef.ActiveDocument numObjects = docRef.PathItems.Count On Error GoTo DisplayError Set aiObject = docRef.PathItems(5) Exit Sub DisplayError: errorMessage = "Couldn't locate 5th path object - Only " errorMessage = errorMessage & numObjects & " objects." MsgBox errorMessage End Sub 12 Aug 03