Adobe 23102480 Scripting Guide - Page 68

Adobe Photoshop CS3 AppleScript Scripting Reference, file that restore original preferences

Page 68 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 68 Note: Look up the following classes in the Adobe Photoshop CS3 AppleScript Scripting Reference, or in the Photoshop CS3 AppleScript Dictionary to see if you understand how you used them in this script: ● wave filter class ● art layer class ● rasterize command ● filter command ● document class: select command, combination type parameter VBS ➤ 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 at the end of the file that restore original preferences: 'create new variables to contain doc width and height 'convert inches to pixels by multiplying the number of inches by 'the resolution (which equals number of pixels per inch) docWidthInPixels = docWidthInInches * resolution docHeightInPixels = docHeightInInches * resolution 'use the Rasterize() method of the ArtLayer class to 'convert the text in the ArtLayer object (contained in the newTextLayer variable) 'to postscript text type newTextLayer.Rasterize (1) 'create an array to define the selection property 'of the Document object 'define the selected area as an array of points in the document docRef.Selection.Select Array(Array(0, 0), _ Array(docWidthInPixels / 2, 0), _ Array(docWidthInPixels / 2, docHeightInPixels), _ Array(0, docHeightInPixels), Array(0, 0)) 'use the ApplyWave() method of the ArtLayer class 'to apply the wave of the selected text newTextLayer.ApplyWave 1, 1, 100, 5, 10, 100, 100, 1, 1, 0 2. Double click the file name in Windows Explorer to run the script. 3. After viewing the document in Photoshop CS3, close the document without saving it. 4. Save the script. Note: Look up the following classes in the Adobe Photoshop CS3 Visual Basic Scripting Reference, or in the Visual Basic Object Browser to see if you understand how you used them in this script: ● ArtLayer class ● ApplyWave method ● Rasterize method ● Selection class: Select method

  • 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
68
Note:
Look up the following classes in the
Adobe Photoshop CS3 AppleScript Scripting Reference
, or in the
Photoshop CS3 AppleScript Dictionary to see if you understand how you used them in this script:
wave filter
class
art layer
class
rasterize
command
filter
command
document
class:
select
command,
combination type
parameter
VBS
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 at the end of the
file that restore original preferences:
'create new variables to contain doc width and height
'convert inches to pixels by multiplying the number of inches by
'the resolution (which equals number of pixels per inch)
docWidthInPixels = docWidthInInches * resolution
docHeightInPixels = docHeightInInches * resolution
'use the Rasterize() method of the ArtLayer class to
'convert the text in the ArtLayer object (contained in the newTextLayer variable)
'to postscript text type
newTextLayer.Rasterize (1)
'create an array to define the selection property
'of the Document object
'define the selected area as an array of points in the document
docRef.Selection.Select Array(Array(0, 0), _
Array(docWidthInPixels / 2, 0), _
Array(docWidthInPixels / 2, docHeightInPixels), _
Array(0, docHeightInPixels), Array(0, 0))
'use the ApplyWave() method of the ArtLayer class
'to apply the wave of the selected text
newTextLayer.ApplyWave 1, 1, 100, 5, 10, 100, 100, 1, 1, 0
2.
Double click the file name in Windows Explorer to run the script.
3.
After viewing the document in Photoshop CS3, close the document without saving it.
4.
Save the script.
Note:
Look up the following classes in the
Adobe Photoshop CS3 Visual Basic Scripting Reference
, or in the
Visual Basic Object Browser to see if you understand how you used them in this script:
ArtLayer
class
ApplyWave
method
Rasterize
method
Selection
class:
Select
method