Adobe 23101764 Scripting Guide - Page 19
AppleScript Sample Code, Visual Basic Sample Code
UPC - 718659340025
View all Adobe 23101764 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 19 highlights
Scripting basics 2 Object Model AppleScript Sample Code This code contains AppleScript commands that instruct the Photoshop application to create a new document with width and height in inches and place an art layer within the document. The art layer is then changed to a text layer, whose contents are set to "Hello World!". tell application "Adobe Photoshop CS" set docRef to make new document with properties ¬ {width:4 as inches, height:2 as inches} set artLayerRef to make new art layer in docRef set kind of artLayerRef to text layer set contents of text object of artLayerRef to "Hello, World!" end tell Visual Basic Sample Code This code contains Visual Basic commands that instruct Photoshop to configure the width and height of a new document in inches and place an art layer within the document. The art layer is then changed to a text item, whose contents are set to "Hello World!". Initial unit settings are restored after the script is run. Dim appRef As New Photoshop.Application Dim originalRulerUnits As Photoshop.PsUnits originalRulerUnits = appRef.Preferences.RulerUnits appRef.Preferences.RulerUnits = psInches Dim docRef As Photoshop.Document Dim artLayerRef As Photoshop.ArtLayer Dim textItemRef As Photoshop.TextItem Set docRef = appRef.Documents.Add(4, 2, 72, "Hello, World!") Set artLayerRef = docRef.ArtLayers.Add artLayerRef.Kind = psTextLayer Set textItemRef = artLayerRef.TextItem textItemRef.Contents = "Hello, World!" appRef.Preferences.RulerUnits = originalRulerUnits Photoshop CS Scripting Guide 15