Adobe 23102480 Scripting Guide - Page 67

To select an area and apply a wave filter to it, Lower left corner

Page 67 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 67 ● theDocHeightInPixels indicates the bottom row in the document; that is row whose coordinate is the total number of rows in the document. Note: The value of theDocHeightInPixels is the total number of pixels that determine the vertical dimension of the document. Rows are stacked vertically. ● Lower left corner: 0, theDocHeightInPixels ● 0 indicates the left-most column in the document. ● theDocHeightInPixels indicates the bottom row in the document ● Upper left corner of the selection: 0,0 ● This closes the selection path back at the initial point. AS ➤ To select an area and apply a wave filter to it: 1. Type the following code into the script file HelloWorldDoc just above the statements that restore original preferences: --create new variables to contain the document object's width and height --determine width and height values by multiplying the --width and height in inches by the resolution --(which equals the number of pixels per inch) set theDocWidthInPixels to theDocWidthInInches * theDocResolution set theDocHeightInPixels to theDocHeightInInches * theDocResolution --use the rasterize command of the art layer object rasterize theTextLayer affecting text contents --create a variable named theSelRegion --assign an array of coordinates as its value set theSelRegion to {{0, 0}, ¬ {theDocWidthInPixels / 2, 0}, ¬ {theDocWidthInPixels / 2, theDocHeightInPixels}, ¬ {0, theDocHeightInPixels}, ¬ {0, 0}} --replace the document object with the selection object --so that the wave is applied only to the selected text select theDocRef region theSelRegion combination type replaced --apply the wave filter using the filter command of the --wave filter class (inherited from the filter options super class) filter current layer of theDocRef using wave filter ¬ with options {class:wave filter, number of generators:1, minimum wavelength:1,¬ maximum wavelength:100, minimum amplitude:5, maximum amplitude:10, ¬ horizontal scale:100, vertical scale:100, wave type:sine,¬ undefined areas:repeat edge pixels, random seed:0} 2. Choose Run to run the script. 3. After viewing the document in Photoshop CS3, close the document without saving it. 4. Save the script in the Script Editor.

  • 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

Photoshop CS3
Adobe Photoshop CS3
Scripting Guide
Scripting Photoshop CS3
67
theDocHeightInPixels
indicates the bottom row in the document; that is row whose coordinate
is the total number of rows in the document.
Note:
The value of
theDocHeightInPixels
is the total number of pixels that determine the vertical
dimension of the document. Rows are stacked vertically.
Lower left corner:
0, theDocHeightInPixels
0
indicates the left-most column in the document.
theDocHeightInPixels
indicates the bottom row in the document
Upper left corner of the selection:
0,0
This closes the selection path back at the initial point.
AS
To select an area and apply a wave filter to it:
1.
Type the following code into the script file
HelloWorldDoc
just above the statements that restore
original preferences:
--create new variables to contain the document object’s width and height
--determine width and height values by multiplying the
--width and height in inches by the resolution
--(which equals the number of pixels per inch)
set theDocWidthInPixels to theDocWidthInInches * theDocResolution
set theDocHeightInPixels to theDocHeightInInches * theDocResolution
--use the rasterize command of the art layer object
rasterize theTextLayer affecting text contents
--create a variable named theSelRegion
--assign an array of coordinates as its value
set theSelRegion to {{0, 0}, ¬
{theDocWidthInPixels / 2, 0}, ¬
{theDocWidthInPixels / 2, theDocHeightInPixels}, ¬
{0, theDocHeightInPixels}, ¬
{0, 0}}
--replace the document object with the selection object
--so that the wave is applied only to the selected text
select theDocRef region theSelRegion combination type replaced
--apply the wave filter using the filter command of the
--wave filter class (inherited from the filter options super class)
filter current layer of theDocRef using wave filter ¬
with options {class:wave filter, number of generators:1, minimum wavelength:1,¬
maximum wavelength:100, minimum amplitude:5, maximum amplitude:10, ¬
horizontal scale:100, vertical scale:100, wave type:sine,¬
undefined areas:repeat edge pixels, random seed:0}
2.
Choose
Run
to run the script.
3.
After viewing the document in Photoshop CS3, close the document without saving it.
4.
Save the script in the Script Editor.