Adobe 23101335 - Photoshop - PC Manual page 40

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

Advertisement

Scripting Photoshop
3
Your first Photoshop script
Here's an example VBScript:
' Hello World Script
Dim appRef
Set appRef = CreateObject( "Photoshop.Application" )
' Remember current unit settings and then set units to
' the value expected by this script
Dim originalRulerUnits
originalRulerUnits = appRef.Preferences.RulerUnits
appRef.Preferences.RulerUnits = 2
' Create a new 4x4 inch document and assign it to a variable.
Dim docRef
Dim artLayerRef
Dim textItemRef
Set docRef = appRef.Documents.Add(4, 4)
' Create a new art layer containing text
Set artLayerRef = docRef.ArtLayers.Add
artLayerRef.Kind = 2
' Set the contents of the text layer.
Set textItemRef = artLayerRef.TextItem
textItemRef.Contents = "Hello, World!"
' Restore unit setting
appRef.Preferences.RulerUnits = originalRulerUnits
To run this script create a text file and copy the script into it. Save the file with a "vbs"
extension. Double-click the file to execute.
40
Photoshop 7.0 Scripting Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop 7.0

Table of Contents