Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting Photoshop CS2 74
--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
make new document with properties ¬
{width:theDocWidthInInches, height:theDocHeightInInches,¬
resolution:theDocResolution, name:theDocString}
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
HelloWorldDoc
.
VBS
➤
To work with document preferences:
1. Create the following script. See
‘Creating and Running a VBScript’ on page 23
for details.
Private Sub CommandButton1_Click()
'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")
'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)
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...