Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting Photoshop CS2 75
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
app.Documents.Add docWidthInInches, docHeightInInches, resolution,
helloWorldStr
End If
'restore beginning preferences
appRef.Preferences.RulerUnits = startRulerUnits
appRef.Preferences.TypeUnits = startTypeUnits
appRef.DisplayDialogs = startDisplayDialogs
End Sub
2. Choose
Run > Run Sub/UserForm
or press F5 to run the script.
3. In Photoshop CS2, choose
Edit > Preferences > Units & Rulers
to verify that your preferences have
been returned to your original settings.
4. After viewing the document in Photoshop CS2, close the document without saving it.
5. To prepare the script for the next section, comment the statements that restore the beginning
preferences by adding straight single quotes as follows:
'app.Preferences.RulerUnits = startRulerUnits
'app.Preferences.TypeUnits = startTypeUnits
6. Name the script
HelloWorldDoc
and save it.
JS
➤
To work with document preferences:
1. Create the following script.
Note:
See
‘Creating and Running a JavaScript’ on page 24
for details on creating a JavaScript.
//create and assign variables for default preferences
startRulerUnits = app.preferences.rulerUnits
startTypeUnits = app.preferences.typeUnits
startDisplayDialogs = app.displayDialogs
//change settings
app.preferences.rulerUnits = Units.INCHES
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
//create and assign variables for document settings
docWidthInInches = 4
docHeightInInches = 2
resolution = 72
//use the length property of the documents object to
//find out if any documents are open
//if none are found, add a document
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...