Adobe 23102480 Scripting Guide - Page 62

Photoshop > Preferences > Units & Rulers, In Photoshop CS3, choose

Page 62 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 62 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 HelloWorldDoc. VBS ➤ To work with document preferences: 1. Create the following script. See 'Creating and Running a VBScript' on page 16 for details. '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 appRef.Documents.Add docWidthInInches, docHeightInInches, resolution, 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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

Photoshop CS3
Adobe Photoshop CS3
Scripting Guide
Scripting Photoshop CS3
62
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
HelloWorldDoc
.
VBS
To work with document preferences:
1.
Create the following script. See
‘Creating and Running a VBScript’ on page 16
for details.
'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
appRef.Documents.Add docWidthInInches, docHeightInInches, resolution,
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.