Adobe 23101335 - Photoshop - PC Manual page 41

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

Advertisement

Scripting Photoshop
3
Your first Photoshop script
3.3.4 JavaScript
// Hello Word Script
// Remember current unit settings and then set units to
// the value expected by this script
var originalUnit = preferences.rulerUnits;
preferences.rulerUnits = Units.INCHES;
// Create a new 4x4 inch document and assign it to a variable
var docRef = documents.add( 4, 4 );
// Create a new art layer containing text
var artLayerRef = docRef.artLayers.add();
artLayerRef.kind = LayerKind.TEXT;
// Set the contents of the text layer.
var textItemRef = artLayerRef.textItem;
textItemRef.contents = "Hello, World!";
// Release references
docRef = null;
artLayerRef = null;
textItemRef = null;
// Restore original ruler unit setting
preferences.rulerUnits = originalUnit;
41
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