
Photoshop CS3
Adobe Photoshop CS3 Scripting Guide Scripting Photoshop CS3 53
AS
set myWebSafeColor to web safe color for foreground color
VBS
Dim myWebSafeColor
Set myWebSafeColor = appRef.ForegroundColor.NearestWebColor
JS
var webSafeColor = new RGBColor()
webSafeColor = app.foregroundColor.nearestWebColor
Working with Filters
To apply a filter in AppleScript, you use the filter command with an option from the class filter
options
. In VBScript and JavaScript, you use a specific filter method. For example, to apply a Gaussian blur
filter, you use the
ApplyGaussianBlur/applyGaussianBlur() method. All filter methods belong to the
ArtLayer object.
Note: Please refer to Photoshop CS3 Help for information about the effects produced by individual filter
types.
The following examples apply the Gaussian blur filter to the active layer.
AS
Use the filter command and then both specify the layer and the name of the filter and any options.
filter current layer of current document using gaussian blur ¬
with options {radius:5}
Note: In the Adobe Photoshop CS3 AppleScript Scripting Reference, or in the Photoshop CS3 AppleScript
Dictionary, look up the
filter command; also look up class filter options.
VBS
appRef.docRef.ActiveLayer.ApplyGaussianBlur 5
Note: In the Adobe Photoshop CS3 Visual Basic Scripting Reference, on in the Visual Basic Object Browser
look up the
ApplyGaussianBlur method and other methods of the ArtLayer object whose name
begins with ‘Apply’.
JS
docRef.activeLayer.applyGaussianBlur(5)
Note: In the Adobe Photoshop CS3 JavaScript Scripting Reference, or in the ExtendScript Object Model
Viewer look up the
applyGaussianBlur() method and other methods of the artLayer object
whose name begins with ‘apply’.
Other Filters
If the filter type that you want to use on your layer is not part of the scripting interface, you can use the
Action Manager from a JavaScript to run a filter. If you are using AppleScript or VBScript, you can run the