Adobe 23101764 Scripting Guide - Page 42
VBScript
UPC - 718659340025
View all Adobe 23101764 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 42 highlights
Scripting Photoshop 3 Your first Photoshop script 3.3.3 VBScript You don't need to use Visual Basic to run scripts on Windows. Another way to script Photoshop is to use a VBA editor (such as the one that is included in Microsoft Word) or to use Windows Scripting Host. Most Windows systems include Windows Scripting Host. If you do not have Windows Scripting Host or would like more information about Windows Scripting Host visit the Microsoft Windows Script Technologies Web site at http://msdn.microsoft.com/scripting/. VBScript considerations Both VBA and Windows Scripting Host use VBScript as their scripting language. The syntax for VBScript is very similar to the Visual Basic syntax. The three main differences relating to the scripts shown in this guide are: - VBScript is not as strongly typed as Visual basic. In Visual Basic you say: Dim aRef as Photoshop.ArtLayer in VBScript you say: Dim aRef For VBScript simply omit the "as" and everything that comes after the "as" (in this case Photoshop.ArtLayer). - VBScript does not support the "as New Photoshop.Application" form. In Visual Basic you can retrieve the Application object as: Dim appRef as New Photoshop.Application In VBScript you write the following to retrieve the Application object: Dim appRef Set appRef = CreateObject("Photoshop.Application") - VBScript does not support enumerations. Here's an example of how to set the extension type that can later be used to save a document. Dim extType As Photoshop.PsExtensionType extType = psUppercase In Visual Basic, the values of the various enumerations are specified in a parenthesis after the enumeration name. For an enumeration value such as "psTextLayer (2)", you would typically use the term "psTextLayer" (rather than "2") to refer to the kind of layer being described. For example: artLayerRef.Kind = psTextLayer VBScript, however, has no access to a type library; consequently, only the enumeration value "2" can be used -- not the term "psTextLayer". For example: artLayerRef.Kind = 2 Photoshop CS Scripting Guide 38