Adobe 23101335 - Photoshop - PC Manual page 52

Scripting guide
Hide thumbs Also See for 23101335 - Photoshop - PC:
Table of Contents

Advertisement

Scripting Photoshop
3
The Application object
Display dialogs
It is important to be able to control dialogs properly from a script. If a dialog is shown 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
unsupervisored (batch) mode you do not want dialogs to be displayed and stop your script.
Using the display dialogs ( DisplayDialogs/displayDialogs ) property on the
application object you can control whether or not dialogs are displayed.
If you set display dialogs to always ( psDisplayAllDialogs/ALL ) , Photoshop
will show all user related dialogs. This is typically not what you want.
If you set display dialogs to error dialogs (DisplayErrorDialogs/ERROR) ,
then only dialogs related to errors are shown. You would typically use this setting when you
are developing a script or if your script is an interactive one that expects a user to be sitting at
the machine while running the script.
If you set display dialogs to never ( DisplayNoDialogs/NO ), then no dialogs
are shown. If an error occurs it will be returned as an error to the script. See section
2.10.4,
"Error handling" on page 31
for more information on catching errors.
Opening a document
When using the open command there are a number of specifiable options. These options are
grouped by file type in the provided open options classes. Because the type and contents of the
file you are working on affects how it is opened, some of the option values may not always be
applicable. It also means that many of the option values do not have well defined default
values.
The best way to determine what values can or should be used for open is to perform an open
command from the user interface. You can then copy the value from the options dialog to your
script. You should perform a complete open operation because there can be multiple dialogs
presented before the document is actually opened. If you cancel one of the open dialogs
without completing the operation you could miss seeing a dialog which contains values
needed in your script.
Specifying file formats to open
Because Photoshop supports many different file formats, the Open command lets you specify
the format of the document you are opening. If you do not specify the format, Photoshop will
infer the type of file for you. Here's how to open a document using its default type:
AS:
set theFile to alias "MyFile.psd"
open theFile
VB:
fileName = "C:\MyFile.psd"
Set docRef = appRef.Open(fileName)
52
Photoshop 7.0 Scripting Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop 7.0

Table of Contents