Adobe 65048599 Scripting Guide - Page 33

Allowing or Preventing Dialogs, Working with the Photoshop Object Model

Page 33 highlights

CHAPTER 3: Scripting Photoshop Allowing or Preventing Dialogs 33 JS The Preferences object is a property of the Application object. preferences.rulerUnits = Units.INCHES preferences.typeUnits = TypeUnits.PIXELS In the Adobe Photoshop CS5 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer, look up the Preferences object to view all of the settings properties you can use. Additionally, look up the preferences property on the Application object. Allowing or Preventing Dialogs It is important to be able to control dialogs properly from a script. If a dialog appears, your script stops until a user dismisses the dialog. This is normally fine in an interactive script that expects a user to be sitting at the machine. But if you have a script that runs in an unsupervised (batch) mode, you do not want dialogs to be displayed and stop your script. You use the display dialogs (DisplayDialogs/displayDialogs) property of the Application object to control whether or not dialogs are displayed. NOTE: Using dialogs in your script is roughly equivalent to using stops in a Photoshop action. AS The following script prevents dialogs from being displayed: set display dialogs to never In the Adobe Photoshop CS5 AppleScript Scripting Reference or in the Photoshop AppleScript Dictionary, look up the Class application to find the values you can use for the display dialogs property. VBS To set dialog preferences, you use the DisplayDialogs property of the Application object. appRef.DisplayDialogs = 3 'for PsDialogModes --> 3 (psDisplayNoDialogs) Note that, because DisplayDialogs is a property of the Application object, you must reference the Application object in the script to get to the property. In the Adobe Photoshop CS5 Visual Basic Scripting Reference, or in the Visual Basic Object Browser, look up the Application object property DisplayDialogs. You'll see the value type for this property is the constant PsDialogModes. You can also look up the options for PsDialogModes. JS To set dialog preferences, you use the displayDialogs property of the Application object. displayDialogs = DialogModes.NO In the Adobe Photoshop CS5 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer, look up the Application object property displayDialogs, and then look up the constant DialogModes. Working with the Photoshop Object Model This section contains information about using the objects in the Photoshop Object Model. For information on object models, see Introduction to Scripting and "Photoshop Object Model" on page 11.

  • 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
  • 86
  • 87

C
HAPTER
3: Scripting Photoshop
Allowing or Preventing Dialogs
33
JS
The
Preferences
object is a property of the
Application
object.
preferences.rulerUnits = Units.INCHES
preferences.typeUnits = TypeUnits.PIXELS
In the
Adobe Photoshop CS5 JavaScript Scripting Reference
, or in the ExtendScript Object Model Viewer, look
up the
Preferences
object to view all of the settings properties you can use. Additionally, look up the
preferences
property on the
Application
object.
Allowing or Preventing Dialogs
It is important to be able to control dialogs properly from a script. If a dialog appears, your script stops
until a user dismisses the dialog. This is normally fine in an interactive script that expects a user to be
sitting at the machine. But if you have a script that runs in an unsupervised (batch) mode, you do not want
dialogs to be displayed and stop your script.
You use the
display
dialogs
(
DisplayDialogs/displayDialogs
) property of the
Application
object
to control whether or not dialogs are displayed.
N
OTE
:
Using dialogs in your script is roughly equivalent to using stops in a Photoshop action.
AS
The following script prevents dialogs from being displayed:
set display dialogs to never
In the
Adobe Photoshop CS5 AppleScript Scripting Reference
or in the Photoshop AppleScript Dictionary,
look up the
Class
application
to find the values you can use for the
display
dialogs
property.
VBS
To set dialog preferences, you use the
DisplayDialogs
property of the
Application
object.
appRef.DisplayDialogs = 3
'for PsDialogModes --> 3 (psDisplayNoDialogs)
Note that, because
DisplayDialogs
is a property of the
Application
object, you must reference the
Application
object in the script to get to the property.
In the
Adobe Photoshop CS5 Visual Basic Scripting Reference
, or in the Visual Basic Object Browser, look up
the
Application
object property
DisplayDialogs
. You’ll see the value type for this property is the
constant
PsDialogModes
. You can also look up the options for
PsDialogModes
.
JS
To set dialog preferences, you use the
displayDialogs
property of the
Application
object.
displayDialogs = DialogModes.NO
In the
Adobe Photoshop CS5 JavaScript Scripting Reference
, or in the ExtendScript Object Model Viewer, look
up the
Application
object property
displayDialogs
, and then look up the constant
DialogModes
.
Working with the Photoshop Object Model
This section contains information about using the objects in the Photoshop Object Model. For information
on object models, see
Introduction to Scripting
and
“Photoshop Object Model” on page 11
.