Adobe 23101335 Scripting Guide - Page 39
VBScript
UPC - 718659152833
View all Adobe 23101335 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 39 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 X" part - 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 save a document. Dim extType As Photoshop.PsExtensionType extType = psUppercase In the Visual Basic reference the value of the various enumerated values are specified in a parenthesis after the enumeration name. For example "psConvertToCMYK (3)" means that from Visual Basic you can use the term "psConvertToCMYK" to refer to the CMYK document mode, scripting languages that do not use a typelibrary can use the value 3. Photoshop 7.0 Scripting Guide 39