Adobe PHOTOSHOP CS 2.0 - SCRIPTING GUIDE Manual page 78

Table of Contents

Advertisement

Adobe Photoshop CS2 Scripting Guide
--check to see whether any documents are open
--if none are found, create a document
--use the default document settings as its properties
if (count of documents) is 0 then
end if
--change the settings back to the original units stored in the variables
set ruler units of settings to theStartRulerUnits
set type units of settings to theStartTypeUnits
set display dialogs to theStartDisplayDialogs
end tell
2. In Photoshop CS2, choose Photoshop > Preferences > Units & Rulers to verify that your preferences
have been returned to your original settings.
3. After viewing the document in Photoshop CS2, close the document without saving it.
4. To prepare the script for the next section, comment the statements that restore the beginning
preferences by adding hyphens as follows:
--set ruler units of settings to theStartRulerUnits
--set type units of settings to theStartTypeUnits
5. Save the script as
VBS
To work with document preferences:
1. Create the following script. See
Private Sub CommandButton1_Click()
'create variables for default preferences, new preferences
Dim startRulerUnits
Dim appRef
Set appRef = CreateObject("Photoshop.Application")
'target Photoshop CS2
Set appRef = New Photoshop.Application
'assign default preferences to save values in variables
startRulerUnits = appRef.Preferences.RulerUnits
startTypeUnits = appRef.Preferences.TypeUnits
startDisplayDialogs = appRef.DisplayDialogs
'set new preferences and document defaults
appRef.Preferences.RulerUnits = 2 'for PsUnits --> 2 (psInches)
appRef.Preferences.TypeUnits = 1 'for PsTypeUnits --> 1 (psPixels)
make new document with properties ¬
{width:theDocWidthInInches, height:theDocHeightInInches,¬
resolution:theDocResolution, name:theDocString}
HelloWorldDoc
Dim startTypeUnits
Dim docWidthInInches
Dim docHeightInInches
Dim resolution
Dim helloWorldStr
Photoshop CS2
.
'Creating and Running a VBScript' on page 23
Scripting Photoshop CS2
for details.
74

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs2

Table of Contents