Adobe 23101335 - Photoshop - PC Manual page 39

Scripting guide
Hide thumbs Also See for 23101335 - Photoshop - PC:
Table of Contents

Advertisement

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:
– VBScript does not support the "as New Photoshop.Application" form.
– VBScript does not support enumerations. Here's an example of how to set the extension
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
Dim aRef as Photoshop.ArtLayer
in VBScript you say:
Dim aRef
For VBScript simply omit the "as X" part
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")
type that can later be used save a document.
Dim extType As Photoshop.PsExtensionType
extType = psUppercase
Scripting Photoshop
Your first Photoshop script
3
39

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop 7.0

Table of Contents