Adobe photoshop cs 2.0 ユーザーガイド

ページ / 91
Photoshop CS2
Adobe Photoshop CS2  Scripting Guide
 Scripting Photoshop CS2     46
jpgSaveOptions.embedColorProfile = true
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE
jpgSaveOptions.matte = MatteType.NONE
jpgSaveOptions.quality = 1
app.activeDocument.saveAs(jpgFile, jpgSaveOptions, true,
Extension.LOWERCASE)
Setting Application Preferences 
Your script can set application preferences such as color picker, file saving options, guide-grid-slice 
settings, and so on. 
Note:
The properties in the 
settings
 class/
Preferences
 object correlate to the Photoshop CS2 
Preferences dialog options, which you display by choosing Photoshop > Preferences on Mac OS or 
Edit > Preferences in Windows versions of Photoshop CS2. For explanations of individual 
preferences, please refer to Photoshop CS2 Help. 
AS 
You use properties of the 
settings
 class to set application preferences in AppleScript. The following script 
sets ruler and type unit settings:
set ruler units of settings to inch units
set type units of settings to pixel units
In the Adobe Photoshop CS2 AppleScript Scripting Reference, look up 
Class settings-object
 to view all of 
the settings properties you can use.
VBS
The 
Preferences
 object is a property of the 
Application
 object. When you use the 
Preferences
 object 
in a VBScript script, you must indicate its containment in the 
Application
 object. 
appRef.Preferences.RulerUnits = 2 'for PsUnits --> 2 (psInches)
appRef.Preferences.TypeUnits = 1 'for PsTypeUnits --> 1 (psPixels)
In the Adobe Photoshop CS2 Visual Basic Scripting Reference, look up the 
Preferences
 object to view all of 
the settings properties you can use. Additionally, look up the 
Application
 object > 
Preferences
 
property. 
JS
The Preferences object is a property of the 
Application
 object. 
preferences.rulerUnits =Units.INCHES
preferences.typeUnits = TypeUnits.PIXELS
In the Adobe Photoshop CS2 JavaScript Scripting Reference, look up the 
Preferences
 object to view all of 
the settings properties you can use. Additionally, look up the 
Application
 object > 
preferences
 
property. 
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.