Adobe 65014293 Scripting Guide - Page 32

Setting Application Preferences

Page 32 highlights

CHAPTER 3: Scripting Photoshop Setting Application Preferences 32 VBS JS Dim appRef,docRef Set appRef = CreateObject("Photoshop.Application") Set docRef = appRef.Documents.Add() Set jpgSaveOptions = CreateObject("Photoshop.JPEGSaveOptions") jpgSaveOptions.EmbedColorProfile = True jpgSaveOptions.FormatOptions = 1 'for psStandardBaseline jpgSaveOptions.Matte = 1 'for psNoMatte jpgSaveOptions.Quality = 1 appRef.ActiveDocument.SaveAs "c:\temp\myFile2", _ jpgSaveOptions, True, 2 'for psLowercase app.documents.add( 4, 4 ) jpgFile = new File( "/Temp001.jpeg" ) jpgSaveOptions = new JPEGSaveOptions() 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 CS4 Preferences dialog options, which you display by choosing Photoshop > Preferences on Mac OS or Edit > Preferences in Windows versions of Photoshop. For explanations of individual preferences, please refer to Photoshop 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 CS4 AppleScript Scripting Reference, or in the Photoshop AppleScript Dictionary, 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 CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser, 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.

  • 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
Setting Application Preferences
32
VBS
Dim appRef,docRef
Set appRef = CreateObject("Photoshop.Application")
Set docRef = appRef.Documents.Add()
Set jpgSaveOptions = CreateObject("Photoshop.JPEGSaveOptions")
jpgSaveOptions.EmbedColorProfile = True
jpgSaveOptions.FormatOptions = 1 'for psStandardBaseline
jpgSaveOptions.Matte = 1 'for psNoMatte
jpgSaveOptions.Quality = 1
appRef.ActiveDocument.SaveAs "c:\temp\myFile2", _
jpgSaveOptions,
True, 2 'for psLowercase
JS
app.documents.add( 4, 4 )
jpgFile = new File( "/Temp001.jpeg" )
jpgSaveOptions = new JPEGSaveOptions()
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.
N
OTE
:
The properties in the
settings
class/
Preferences
object correlate to the Photoshop CS4
Preferences dialog options, which you display by choosing
Photoshop > Preferences
on Mac OS or
Edit > Preferences
in Windows versions of Photoshop. For explanations of individual preferences, please
refer to Photoshop 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 CS4 AppleScript Scripting Reference
, or in the Photoshop AppleScript Dictionary,
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 CS4 Visual Basic Scripting Reference
, or in the Visual Basic Object Browser, 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.