C
3: Scripting Photoshop
HAPTER
JS
To apply a motionblur filter to HelloWorldDoc:
1. Type the following code into the script file
original preferences.
//change the value of selRegion to the other half of the document
selRegion = Array(Array(docWidthInPixels / 2, 0),
Array(docWidthInPixels, 0),
Array(docWidthInPixels, docHeightInPixels),
Array(docWidthInPixels / 2, docHeightInPixels),
Array(docWidthInPixels / 2, 0))
docRef.selection.select(selRegion)
newTextLayer.applyMotionBlur(45, 5)
docRef.selection.deselect()
2. Save the script, and then open Photoshop and select the script from the Scripts menu (choose File >
Script > HelloWorldDoc).
N
: Look up the
OTE
Scripting Reference, or in the ExtendScript Object Model Viewer to see if you understand how you used it in
this script.
class
ArtLayer
applyMotionBlur()
just above the statements that restore
HelloWorldDoc
method in the Adobe Photoshop CS5 JavaScript
Advanced Scripting 72