Adobe 23102480 Scripting Guide - Page 77

This launches Photoshop, document within the script. Since the script is opening a document

Page 77 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Action Manager 77 id9 = objApp.CharIDToTypeID( "Embs" ) DIM desc4 SET desc4 = CreateObject( "Photoshop.ActionDescriptor" ) DIM id10 id10 = objApp.CharIDToTypeID( "Angl" ) Call desc4.PutInteger( id10, angle ) DIM id11 id11 = objApp.CharIDToTypeID( "Hght" ) Call desc4.PutInteger( id11, height ) DIM id12 id12 = objApp.CharIDToTypeID( "Amnt" ) Call desc4.PutInteger( id12, amount ) Call objApp.ExecuteAction( id9, desc4, dialogMode ) End Function 5. To use a VBScript to apply the Emboss filter to a document, include the emboss function in the script and call the function with the desired parameters. For example, the following example applies the Emboss filter with angle 75, height 2, and amount 89. Before the script calls the function, it needs to have an open document. (See 'Opening a Document' on page 26, for help in writing the code to open a document within the script.) Since the script is opening a document, it needs access to the Photoshop DOM when it calls the Application .Open method, so the script must create the Photoshop.Application object before it opens a new document. DIM objApp SET objApp = CreateObject("Photoshop.Application") 'Open the document in the script filename = "C:\MyFile" DIM docRef SET docRef = objApp.Open(filename) 'Call emboss with desired parameters Call Emboss( 75, 2, 89 ) Function Emboss( angle, height, amount ) REM Use dialog mode 3 for show no dialogs DIM dialogMode dialogMode = 3 DIM id9 id9 = objApp.CharIDToTypeID( "Embs" ) DIM desc4 SET desc4 = CreateObject( "Photoshop.ActionDescriptor" ) DIM id10 id10 = objApp.CharIDToTypeID( "Angl" ) Call desc4.PutInteger( id10, angle ) DIM id11 id11 = objApp.CharIDToTypeID( "Hght" ) Call desc4.PutInteger( id11, height ) DIM id12 id12 = objApp.CharIDToTypeID( "Amnt" ) Call desc4.PutInteger( id12, amount ) Call objApp.ExecuteAction( id9, desc4, dialogMode ) End Function 6. Apply the emboss filter script by double clicking on the file emboss.vbs. This launches Photoshop, opens the file and applies the emboss filter to the file.

  • 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
Action Manager
77
id9 = objApp.CharIDToTypeID( "Embs" )
DIM desc4
SET desc4 = CreateObject( "Photoshop.ActionDescriptor" )
DIM id10
id10 = objApp.CharIDToTypeID( "Angl" )
Call desc4.PutInteger( id10, angle )
DIM id11
id11 = objApp.CharIDToTypeID( "Hght" )
Call desc4.PutInteger( id11, height )
DIM id12
id12 = objApp.CharIDToTypeID( "Amnt" )
Call desc4.PutInteger( id12, amount )
Call objApp.ExecuteAction( id9, desc4, dialogMode )
End Function
5.
To use a VBScript to apply the Emboss filter to a document, include the emboss function in the script
and call the function with the desired parameters. For example, the following example applies the
Emboss filter with angle 75, height 2, and amount 89. Before the script calls the function, it needs to
have an open document. (See
‘Opening a Document’ on page 26
, for help in writing the code to open a
document within the script.) Since the script is opening a document, it needs access to the Photoshop
DOM when it calls the
Application .Open
method, so the script must create the
Photoshop
.
Application
object before it opens a new document.
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
'Open the document in the script
filename = “C:\MyFile”
DIM docRef
SET docRef = objApp.Open(filename)
'Call emboss with desired parameters
Call Emboss( 75, 2, 89 )
Function Emboss( angle, height, amount )
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM id9
id9 = objApp.CharIDToTypeID( "Embs" )
DIM desc4
SET desc4 = CreateObject( "Photoshop.ActionDescriptor" )
DIM id10
id10 = objApp.CharIDToTypeID( "Angl" )
Call desc4.PutInteger( id10, angle )
DIM id11
id11 = objApp.CharIDToTypeID( "Hght" )
Call desc4.PutInteger( id11, height )
DIM id12
id12 = objApp.CharIDToTypeID( "Amnt" )
Call desc4.PutInteger( id12, amount )
Call objApp.ExecuteAction( id9, desc4, dialogMode )
End Function
6.
Apply the emboss filter script by double clicking on the file
emboss.vbs
. This launches Photoshop,
opens the file and applies the emboss filter to the file.