Adobe 26001360 Scripting Guide - Page 293
Selection, Empty, DocumentColorSpace, DoScript, ActionIsRunning, Sleep
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 293 highlights
Adobe Illustrator CS Scripting Guide 293 Notes To open a document and obtain a reference to the document that was opened use this code: ' Open a document and get the reference to it Dim appRef as New Illustrator.Application Dim docRef as Illustrator.Document Set docRef = appRef.Open("C:\temp\aFile.ai") In Illustrator, the application's Selection can be accessed as well as modified. The selection will contain Empty when there are no selected objects. To deselect all objects in the current document, simply set the selection to Empty, as the following example shows. Private Sub DeselectAll_Click() Dim appRef As New Illustrator.Application appRef.activeDocument.Selection = Empty End Sub A reference to a text range is returned when there is an active insertion point in the contents of a TextFrame. Similarly, a reference to a range of text is returned when characters are selected in the contents of a TextFrame. If the Open method is called to open a pre-Illustrator 9 document that contains both RGB and CMYK colors and the DocumentColorSpace parameter is not supplied, Illustrator will display a dialog to the user. When the DocumentColorSpace parameter is supplied and Illustrator encounters documents containing both color spaces, the document will be opened without a dialog and all colors will be converted to the specified color space. You can run an action from the Action Palette from a script by using the DoScript method. When you do this the control returns to your script before the action has completed. You should use the ActionIsRunning property to test for when the action has completed before executing any other VB command. If you are using VBScript, you can use the Sleep method defined on the WScript object to insert a pause to test this property. If you are using Visual Basic please refer to the "Windows DoAction" example for an example of how to wait for an action to complete. VBScript example: Dim appRef Set appRef = CreateObject("Illustrator.Application") appRef.DoScript "Opacity 60 (selection)", "Default Actions" WHILE(appRef.ActionIsRunning) WScript.sleep 1000 12 Aug 03