Adobe 23102480 - Photoshop CS3 - PC Programming Manual page 62

Scripting guide
Table of Contents

Advertisement

Adobe Photoshop CS3 Scripting Guide
set display dialogs to theStartDisplayDialogs
end tell
2. In Photoshop CS3, choose Photoshop > Preferences > Units & Rulers to verify that your preferences
have been returned to your original settings.
3. After viewing the document in Photoshop CS3, close the document without saving it.
4. Save the script as
VBS
To work with document preferences:
1. Create the following script. See
'create variables for default preferences, new preferences
Dim startRulerUnits
Dim startTypeUnits
Dim docWidthInInches
Dim docHeightInInches
Dim resolution
Dim helloWorldStr
Dim appRef
Set appRef = CreateObject("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)
appRef.DisplayDialogs = 3 'for PsDialogModes --> 3 (psDisplayNoDialogs)
docWidthInInches = 4
docHeightInInches = 2
resolution = 72
helloWorldStr = "Hello, World!"
'see if any documents are open
'if none, create one using document defaults
If appRef.Documents.Count = 0 Then
helloWorldStr
End If
'restore beginning preferences
appRef.Preferences.RulerUnits = startRulerUnits
appRef.Preferences.TypeUnits = startTypeUnits
appRef.DisplayDialogs = startDisplayDialogs
2. Double click the file name in Windows Explorer to run the script.
3. In Photoshop CS3, choose Edit > Preferences > Units & Rulers to verify that your preferences have
been returned to your original settings.
.
HelloWorldDoc
'Creating and Running a VBScript' on page 16
appRef.Documents.Add docWidthInInches, docHeightInInches, resolution,
Photoshop CS3
Scripting Photoshop CS3
for details.
62

Advertisement

Table of Contents
loading

This manual is also suitable for:

13102498 - photoshop cs3 - macPhotoshop cs3

Table of Contents