Adobe 65015634 Scripting Guide

Adobe 65015634 - Photoshop CS4 - PC Manual

Adobe 65015634 manual content summary:

  • Adobe 65015634 | Scripting Guide - Page 1
    ADOBE PHOTOSHOP CS4 SCRIPTING GUIDE
  • Adobe 65015634 | Scripting Guide - Page 2
    Systems Incorporated. All rights reserved. Adobe® Creative Suite® 4 Photoshop® Scripting Guide Adobe, the Adobe logo, Illustrator, and Photoshop are either registered trademarks or trademarks of Adobe Systems Inc. in the United States and/or other countries. Apple and Mac OS are trademarks of Apple
  • Adobe 65015634 | Scripting Guide - Page 3
    Contents 1 Introduction 6 About this Manual 6 Conventions in this Guide 6 2 Photoshop Scripting Basics 8 Scripting Overview 8 Why use scripts instead of actions 8 Scripting Support in Photoshop 9 JavaScript support 9 Executing other scripts 10 Startup scripts 10 Executing JavaScripts from
  • Adobe 65015634 | Scripting Guide - Page 4
    28 Specifying file formats to open 29 Saving a Document 31 Setting Application Preferences 32 Allowing or Preventing Dialogs 33 Working with the Photoshop Object Model 33 Using the Application object 34 Using the Document object 34 Manipulating a document object 35 Working with layer objects
  • Adobe 65015634 | Scripting Guide - Page 5
    Contents 5 AppleScript unit considerations 56 Using unit values in calculations 57 Unit value usage 57 Setting ruler and type units in a script 59 Sample Workflow Automation JavaScripts 60 Advanced Scripting 60 Working with document preferences 61 Applying color to a text item 64 Applying
  • Adobe 65015634 | Scripting Guide - Page 6
    Introduction About this Manual This manual provides an introduction to scripting Adobe® Photoshop® CS4 on Mac OS® and Windows®. Chapter 1 covers the basic conventions used in this manual. Chapter 2 covers a brief overview of scripting, how to execute scripts, and the Photoshop object model. Chapter
  • Adobe 65015634 | Scripting Guide - Page 7
    CHAPTER 1: Introduction Conventions in this Guide 7 In this case, display dialogs refers to the AppleScript property, DisplayDialogs refers to the VBScript property and displayDialogs refers to the JavaScript property. For larger
  • Adobe 65015634 | Scripting Guide - Page 8
    please use the reference information in the three reference manuals provided with this installation: Adobe Photoshop CS4 AppleScript Scripting Reference, Adobe Photoshop CS4 Visual Basic Scripting Reference, and Adobe Photoshop CS4 JavaScript Scripting Reference. NOTE: You can also view information
  • Adobe 65015634 | Scripting Guide - Page 9
    you are using, you could target both Photoshop and another Adobe Creative Suite 4 Application, such as Adobe Illustrator® CS4, in the same script. ➤ You . NOTE: See Photoshop Help for more information on Photoshop Actions. Scripting Support in Photoshop Photoshop supports scripting in three scripting
  • Adobe 65015634 | Scripting Guide - Page 10
    folder for user-defined scripts is: C:\Program Files\Common Files\Adobe\Startup Scripts CS4\Adobe Photoshop ➤ On Mac OS, the startup folder for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS4/Adobe Photoshop If your script is in this main startup folder, it is
  • Adobe 65015634 | Scripting Guide - Page 11
    application) through a scripting language. For additional information about Adobe object models and the scripting languages that support them, see Introduction to Scripting. The Photoshop DOM consists of a hierarchical representation of the Photoshop application, the documents used in it, and the
  • Adobe 65015634 | Scripting Guide - Page 12
    more information on using document objects, see "Creating New Objects in a Script" on page 23 and "Using the Document object" on page 34. Layer classes Photoshop has two types of layers: an Art Layer that can contain image contents and a Layer Set that can contain zero or more art layers. An
  • Adobe 65015634 | Scripting Guide - Page 13
    store pixel information about an image's color. Image color determines the number of channels available. An RGB image, for example, has four default and are called component channels. In addition to the component channels, Photoshop lets you to create additional channels. You can create a spot color
  • Adobe 65015634 | Scripting Guide - Page 14
    Tool. Measurement Scale class The Measurement Scale object provides scripting support for the new Measurement Scale feature that allows you to set a scale for your document. The containment hierarchy and the Photoshop user interface The following table provides describes how each object relates
  • Adobe 65015634 | Scripting Guide - Page 15
    script what to do next. Choose File > Scripts > Script Events Manager. Preferences The application preference settings. Choose Edit > Preferences in Windows, or Photoshop > Preferences in Mac OS. History State Stores a version of the document in the state the document was in each time you saved
  • Adobe 65015634 | Scripting Guide - Page 16
    about using comments, see Introduction to Scripting. For example, look up the art ArtLayer object in either the Adobe Photoshop CS4 JavaScript Scripting Reference or in the Adobe Photoshop CS4 Visual Basic Scripting Reference. One of the properties of this object is Kind( kind). The value type for
  • Adobe 65015634 | Scripting Guide - Page 17
    section demonstrates a very simple script in each of the three scripting languages for Photoshop. Traditionally, the first thing to accomplish in any programming environment is the display specific path in the containment hierarchy, as illustrated below. Application Document Art Layer Text Item
  • Adobe 65015634 | Scripting Guide - Page 18
    are comments. Entering the comments is optional. -- Sample script to create a new text item and -- change its contents. --target Photoshop CS4 tell application "Adobe Photoshop CS4" -- Create a new document and art layer. set docRef to make new document with properties ¬ {width:4 as inches, height
  • Adobe 65015634 | Scripting Guide - Page 19
    run a JavaScript that displays the text Hello World! in a Photoshop document. Because you will be actually using Photoshop to run your JavaScripts, it is not necessary to include code that opens Photoshop at the beginning of the script. NOTE: Adobe has created the Extend Script scripting language to
  • Adobe 65015634 | Scripting Guide - Page 20
    jsx file name extension in the Presets/Scripts folder in your Adobe Photoshop CS4 directory. NOTE: You must place your JavaScripts in the the application. NOTE: Photoshop also supports JavaScript files that use a .js extension. 3. Do either of the following: ➣ If Photoshop is already open, choose
  • Adobe 65015634 | Scripting Guide - Page 21
    these instructions will help you quickly understand how to script Photoshop. Viewing Photoshop Objects, Commands, and Methods The Photoshop reference material for each of the three scripting languages is found in the reference manuals provided in this installation: ➤ Adobe Photoshop CS4 AppleScript
  • Adobe 65015634 | Scripting Guide - Page 22
    Basic. 2. Select View > Object Browser. 3. In the Browse drop-down box, select Edit Custom Component Set. 4. On the COM tab, find "Adobe Photoshop CS4 Object Library". Select it. 5. Click Add. The selected library appears in the "Selected Projects and Components" portion of the window. 6. Click OK
  • Adobe 65015634 | Scripting Guide - Page 23
    enclosing your script in the following statements: tell application "Adobe Photoshop CS4" ... end tell NOTE: Because you include all samples throughout this guide do not reference the Application object. Creating New Objects in a Script To create a new document in the Photoshop application, you
  • Adobe 65015634 | Scripting Guide - Page 24
    's AppleScript dictionary" on page 21. ➤ To find out which commands can be used with an object, look up the object in the Adobe Photoshop CS4 AppleScript Scripting Reference. If an object has valid commands, there will be a "Valid Commands" list at the end of the object description. VBS In
  • Adobe 65015634 | Scripting Guide - Page 25
    which are created with the Add method on either the ArtLayers or LayerSets collections. For more information, look up the Layers object in the Adobe Photoshop CS4 Visual Basic Scripting Reference. JS In JavaScript, you can use the add() method only with the collection name. The add() method is not
  • Adobe 65015634 | Scripting Guide - Page 26
    of the document; a document is the parent of a layer, selection, or channel. For example, if you look at the Application object in the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer, you find one of its properties is activeDocument; if you look at the
  • Adobe 65015634 | Scripting Guide - Page 27
    at least one layer. appRef.ActiveDocument = docRef docRef.ActiveLayer = docRef.Layers(1) Look up the ActiveLayer property on the Document object in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser. NOTE: You can also use the name of the layer to
  • Adobe 65015634 | Scripting Guide - Page 28
    the document name (that is, the path to the file that contains the document) with the command. Opening a file with default file format Because Photoshop supports many different file formats, the open/Open/open() command lets you specify the format of the document you are opening. If you do not
  • Adobe 65015634 | Scripting Guide - Page 29
    Visual Basic Scripting Reference, or the Adobe Photoshop CS4 JavaScript Scripting Reference, look up the PhotoCDOpenOptions or EPSOpenOptions objects. The following examples demonstrate how to open a generic (multi-page/multi-image) PDF document with the following specifications: ➤ The document will
  • Adobe 65015634 | Scripting Guide - Page 30
    is not twice as wide as it is tall. tell application "Adobe Photoshop CS4" set myFilePath to alias "OS X 10.4.8 US:Users:psauto:Desktop:opal_screen.pdf" with timeout of 300 seconds open myFilePath as PDF with options ¬ {class:PDF open options, ¬ mode:RGB, resolution:72, use antialias:true, page
  • Adobe 65015634 | Scripting Guide - Page 31
    up the class EPS save options. ➤ In the Adobe Photoshop CS4 Visual Basic Scripting Reference or in the Adobe Photoshop CS4 JavaScript Scripting Reference look up EPSSaveOptions. Save Classes Save Options Photoshop BMP GIF EPS JPEG PDF Pict File Pict Resource Pixar PNG TIFF Raw DSC1
  • Adobe 65015634 | Scripting Guide - Page 32
    guide-grid-slice settings, and so on. NOTE: The properties in the settings class/Preferences object correlate to the Photoshop CS4 Preferences dialog options, which you display by choosing Photoshop In the Adobe Photoshop CS4 AppleScript Scripting Reference, or in the Photoshop AppleScript
  • Adobe 65015634 | Scripting Guide - Page 33
    is a property of the Application object, you must reference the Application object in the script to get to the property. In the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser, look up the Application object property DisplayDialogs. You'll see the value
  • Adobe 65015634 | Scripting Guide - Page 34
    = app.fonts ➤ The amount of unused memory available to Adobe Photoshop, using the free memory (FreeMemory/freeMemory) property of the Application manual or the object browser of the language you are using. Using the Document object The Document object can represent any open document in Photoshop.
  • Adobe 65015634 | Scripting Guide - Page 35
    . ➤ Restore the original ruler units. NOTE: See "Setting Application Preferences" on page 32 for information on ruler units. AS tell application "Adobe Photoshop CS4" set saveUnit to ruler units of settings set ruler units of settings to inch units set duckFile to alias ¬ "OS X 10.4.8 US
  • Adobe 65015634 | Scripting Guide - Page 36
    object model contains two types of layer objects: ➤ ArtLayer objects, which can contain image contents and are basically equivalent to Layers in the Photoshop application. NOTE: An ArtLayer object can also contain text if you use the kind property to set the ArtLayer object's type to text layer
  • Adobe 65015634 | Scripting Guide - Page 37
    following examples demonstrate how to create an ArtLayer object filled with red at the beginning of the current document. tell application "Adobe Photoshop CS4" make new document make new art layer at beginning of current document ¬ with properties {name:"MyBlendLayer", blend mode:normal} select all
  • Adobe 65015634 | Scripting Guide - Page 38
    object in the current document: tell application "Adobe Photoshop CS4" make new document with properties {name:"My Photoshop application (rather than a script), the layer is added to the Layers palette and given a number. These numbers act as layer names and do not correspond to the index numbers
  • Adobe 65015634 | Scripting Guide - Page 39
    reference names do not remain constant. Refer to an AppleScript language guide or text book for information on referencing a file using either as layer with the same method. Dim appRef, docRef Set appRef = CreateObject("Photoshop.Application") 'Make a new document and a first layer in the document
  • Adobe 65015634 | Scripting Guide - Page 40
    CHAPTER 3: Scripting Photoshop Working with the Photoshop Object Model 40 Linking layer objects Scripting also supports linking and Look up Link in as a method of the ArtLayer object in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser. Additionally
  • Adobe 65015634 | Scripting Guide - Page 41
    , look up the following: ➤ The Kind/kind and TextItem/textItem properties of the ArtLayer object in the Adobe Photoshop CS4 Visual Basic Scripting Reference, Adobe Photoshop CS4 JavaScript Scripting Reference, or in the Visual Basic Object Browser and the ExtendScript Object Model Viewer. ➤ The
  • Adobe 65015634 | Scripting Guide - Page 42
    of the ArtLayer object. To find the properties and methods you can use with a text layer, look up the TextItem object. In the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer, look up the textItem property of the ArtLayer object. To find the properties
  • Adobe 65015634 | Scripting Guide - Page 43
    Dictionary, look up the command select. Also, look up the selection property of the Document object, and the selection-object. ➤ In the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser, look up Selection as a property of the Document object. Also, look up
  • Adobe 65015634 | Scripting Guide - Page 44
    can change the size of a selected area using the expand, contract, and feather commands. The values are passed in the ruler units stored in Photoshop preferences and can be changed by your scripts. If your ruler units are set to pixels, then the following examples will expand, contract, and feather
  • Adobe 65015634 | Scripting Guide - Page 45
    with contents ¬ {class:RGB color, red:255, green:0, blue:0} blend mode ¬ vivid light opacity 25 without preserving transparency Set fillColor = CreateObject("Photoshop.SolidColor") fillColor.RGB.Red = 255 fillColor.RGB.Green = 0 fillColor.RGB.Blue = 0 selRef.Fill fillColor, 15, 25, False JS var
  • Adobe 65015634 | Scripting Guide - Page 46
    copy, cut and paste selections. Working with Channel objects The Channel object gives you access to much of the available functionality on Photoshop channels. You can create, delete, and duplicate channels or retrieve a channel's histogram and change its kind. See "Creating New Objects in a Script
  • Adobe 65015634 | Scripting Guide - Page 47
    AppleScript Dictionary, look up the properties for the class info-object. ➤ In the Adobe Photoshop CS4 Visual Basic Scripting Reference, the Adobe Photoshop CS4 JavaScript Scripting Reference, the Visual Basic Object Browser or the ExtendScript Object Model Viewer, look up the properties for
  • Adobe 65015634 | Scripting Guide - Page 48
    to set up notification for. Many event IDs are listed in an Appendix in the Adobe Photoshop CS4 JavaScript Scripting Reference, Adobe Photoshop CS4 Visual Basic Scripting Reference, and Adobe Photoshop CS4 AppleScript Scripting Reference. Some events also operate on several types of objects, and the
  • Adobe 65015634 | Scripting Guide - Page 49
    line. AS --line #1--it's a straight line so the coordinates for anchor, left, and --right for each point have the same coordinates tell application "Adobe Photoshop CS4" set ruler units of settings to pixel units set type units of settings to pixel units set docRef to make new document with
  • Adobe 65015634 | Scripting Guide - Page 50
    of PathPointInfo objects. The line has two points, 'so there are two PathPointInfo objects. Set lineArray(0) = CreateObject("Photoshop.PathPointInfo") lineArray(0).Kind = 2 ' for PsPointKind --> 2 (psCornerPoint) lineArray(0).Anchor = Array(100, 100) lineArray(0).LeftDirection = lineArray(0).Anchor
  • Adobe 65015634 | Scripting Guide - Page 51
    myPathItem.strokePath(ToolType.BRUSH) Working with color objects Your scripts can use the same range of colors that are available from the Photoshop user interface. Each color model has its own set of properties. For example, the RGB color (RGBColor/RGBColor) class contains three properties
  • Adobe 65015634 | Scripting Guide - Page 52
    its CMYK equivalent. get foreground color convert color foreground color to CMYK Look up the following in the Adobe Photoshop CS4 AppleScript Scripting Reference or in the Photoshop AppleScript Dictionary: ➤ In the "Objects" section, the foreground color property of the class application ➤ In the
  • Adobe 65015634 | Scripting Guide - Page 53
    a way to access the cmyk equivalent of the rgb color. var someColor = foregroundColor.cmyk Look up the following in the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer: ➤ cmyk as a property of the SolidColor object ➤ foregroundColor as a property
  • Adobe 65015634 | Scripting Guide - Page 54
    method and other methods of the ArtLayer object whose name begins with "Apply." JS docRef.activeLayer.applyGaussianBlur(5) NOTE: In the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer look up the applyGaussianBlur() method and other methods of the
  • Adobe 65015634 | Scripting Guide - Page 55
    copy merged selection of docRef VBS docRef.Selection.Copy True Look up the Copy method for the ArtLayer and Selection objects in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser JS docRef.selection.copy(true) Look up the copy() method for the
  • Adobe 65015634 | Scripting Guide - Page 56
    . NOTE: These settings correspond to those found in the Photoshop preference dialog under Photoshop > Preferences > Units & Rulers on Mac OS or Edit > Preferences > Units & Rulers in Windows. Unit values All languages support plain numbers for unit values. These values are treated as being of
  • Adobe 65015634 | Scripting Guide - Page 57
    reference to cm or mm. They are not supported by the AppleScript terminology. Using unit values in write: set newValue to (inchValue as number) * 5 NOTE: In AppleScript you run set inchValue to pixelValue as inches NOTE: Because Photoshop is a pixel-oriented application you may not always get
  • Adobe 65015634 | Scripting Guide - Page 58
    the property of the object in the Adobe Photoshop CS4 Visual Basic Scripting Reference, the Adobe Photoshop CS4 JavaScript Scripting Reference, the Visual Basic Object Browser, or the ExtendScript Object Model Viewer. Class/object Document EPS open options PDF open options lens flare open options
  • Adobe 65015634 | Scripting Guide - Page 59
    DeltaY) (deltaX, deltaY) Setting ruler and type units in a script The unit type settings of the two Photoshop rulers control how numbers are interpreted when dealing with properties and parameters that support unit values. Be sure to set the ruler units as needed at the beginning of your scripts
  • Adobe 65015634 | Scripting Guide - Page 60
    The following sample workflow automation JavaScripts are provided with Photoshop and demonstrate various kinds of scripting usage. The Comps to Files.jsx Saves layer comps as files. Layer Comps to PDF.jsx Saves layer comps as a PDF presentation. Layer Comps to WPG.jsx Saves layer comps as a
  • Adobe 65015634 | Scripting Guide - Page 61
    and run the following script. See "Creating and running an AppleScript" on page 18 for details. tell application "Adobe Photoshop CS4" --make Photoshop CS4 the active (front-most) application activate --create variables for the default settings set theStartRulerUnits to ruler units of settings
  • Adobe 65015634 | Scripting Guide - Page 62
    of settings to theStartRulerUnits set type units of settings to theStartTypeUnits set display dialogs to theStartDisplayDialogs end tell 2. In Photoshop, choose Photoshop > Preferences > Units & Rulers to verify that your preferences have been returned to your original settings. 3. After viewing the
  • Adobe 65015634 | Scripting Guide - Page 63
    Edit > Preferences > Units & Rulers to verify that your preferences have been returned to your original settings. 3. After viewing the document in Photoshop, close the document without saving it. 4. Name the script HelloWorldDoc and save it. JS To work with document preferences: 1. Create the
  • Adobe 65015634 | Scripting Guide - Page 64
    executes your commands one by one. 3. After viewing the document in Photoshop, close the document without saving it. NOTE: Look up the following classes in the Adobe Photoshop CS4 AppleScript Scripting Reference or in the Photoshop AppleScript Dictionary to see if you understand how you used them in
  • Adobe 65015634 | Scripting Guide - Page 65
    executes your commands one by one. 3. After viewing the document in Photoshop, close the document without saving it. NOTE: Look up the following classes in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser to see if you understand how you used them
  • Adobe 65015634 | Scripting Guide - Page 66
    executes your commands one by one. 3. After viewing the document in Photoshop, close Photoshop without saving the document. NOTE: Look up the following classes in the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer to see if you understand how you
  • Adobe 65015634 | Scripting Guide - Page 67
    area. The number of coordinates determines the shape of the selection. The last coordinate defined must be the same as the first so that the area is a closed selection path. NOTE: See "Photoshop Object Model" on page 11 for information on selection objects and other Photoshop objects. The array
  • Adobe 65015634 | Scripting Guide - Page 68
    using wave filter ¬ with options {class:wave filter, number of generators:1, minimum wavelength:1,¬ maximum wavelength:100, minimum NOTE: Look up the following classes in the Adobe Photoshop CS4 AppleScript Scripting Reference, or in the Photoshop AppleScript Dictionary to see if you understand how
  • Adobe 65015634 | Scripting Guide - Page 69
    convert inches to pixels by multiplying the number of inches by 'the resolution (which equals number of pixels per inch) docWidthInPixels = 4. Save the script. NOTE: Look up the following classes in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser to
  • Adobe 65015634 | Scripting Guide - Page 70
    inches to pixels by multiplying the number of inches by //the resolution (which equals number of pixels per inch) docWidthInPixels the document in Photoshop, close Photoshop without saving the document. NOTE: Look up the following classes in the Adobe Photoshop CS4 JavaScript Scripting Reference,
  • Adobe 65015634 | Scripting Guide - Page 71
    .Selection.Deselect 2. Double click on the file in Windows Explorer to run the script. NOTE: Look up the ArtLayer class: ApplyMotionBlur method in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser to see if you understand how you used it in this script:
  • Adobe 65015634 | Scripting Guide - Page 72
    and select the script from the Scripts menu (choose File > Script > HelloWorldDoc). NOTE: Look up the ArtLayer class applyMotionBlur() method in the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer to see if you understand how you used it in this script.
  • Adobe 65015634 | Scripting Guide - Page 73
    JavaScript-based Action Manager code from AppleScript" on page 80. Installing ScriptListener The ScriptListener plug-in is located in the ..\Adobe Photoshop CS4\Scripting\Utilities folder. To install the ScriptListener: 1. Select the file ScriptListener.8li and then choose Edit > Copy. 2. Paste the
  • Adobe 65015634 | Scripting Guide - Page 74
    the ..\Adobe Photoshop CS4\ Scripting\Utilities folder. 3. Delete the file ScriptListener.8li from the following location: ..\Adobe Photoshop CS Action Reference are part of the Action Manager functionality. For detailed information about these objects, see the appropriate reference manual, or use
  • Adobe 65015634 | Scripting Guide - Page 75
    an action. The example in this section assumes you have followed the instructions in "Recording a Script using ScriptListener" on page 74. The end of the file you will see code similar to the following (although your numbers may be different): var id19 = charIDToTypeID( "Embs" ); var desc4 =
  • Adobe 65015634 | Scripting Guide - Page 76
    ( id35, amount ); executeAction( id32, desc7,DialogModes.NO ); } 6. Open Photoshop, to apply the emboss filter by selecting File > Scripts > Browse, and action. The example in this section assumes you have followed the instructions in "Recording a Script using ScriptListener" on page 74. The
  • Adobe 65015634 | Scripting Guide - Page 77
    the desktop. At the end of the file you will see code similar to the following (although your numbers may be different): DIM objApp SET objApp = CreateObject("Photoshop.Application") REM Use dialog mode 3 for show no dialogs DIM dialogMode dialogMode = 3 DIM id9 id9 = objApp.CharIDToTypeID( "Embs
  • Adobe 65015634 | Scripting Guide - Page 78
    Action Manager from a VBS Script 78 4. Wrap the code in a VBScript function. In the following example, the function name is Emboss. The creation of the Photoshop application object needs to be outside of the function, as we will explain in the next step. DIM objApp SET objApp = CreateObject
  • Adobe 65015634 | Scripting Guide - Page 79
    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. Running JavaScript-based Action Manager code from VBScript You can also access
  • Adobe 65015634 | Scripting Guide - Page 80
    [0], arguments[1], arguments[2] ); 3. The following AppleScript code sample opens a document and runs the Emboss filter on it: tell application "Adobe Photoshop CS4" set theFile to alias "Application:Documents:MyFile" open theFile do javascript (file ) ¬ with arguments { 75
  • Adobe 65015634 | Scripting Guide - Page 81
    ( "Opn " ); var desc5 = new ActionDescriptor(); var id15 = charIDToTypeID( "null" ); desc5.putPath( id15, new File( "C:\\Program Files\\Adobe\\Adobe Photoshop CS4\\ Samples\\Fish.psd" ) ); executeAction( id14, desc5, DialogModes.NO ); 4. The executeAction method runs the action from a script, and it
  • Adobe 65015634 | Scripting Guide - Page 82
    CHAPTER 4: Action Manager Using ScriptListener to find event IDs and class IDs 82 var id17 = charIDToTypeID( "Mk " ); var desc6 = new ActionDescriptor(); var id18 = charIDToTypeID( "Nw " ); var desc7 = new ActionDescriptor(); var id19 = charIDToTypeID( "Md " ); var id20 = charIDToTypeID( "RGBM"
  • Adobe 65015634 | Scripting Guide - Page 83
    CHAPTER 4: Action Manager Using ScriptListener to find event IDs and class IDs 83 6. The executeAction method for both of these actions takes an argument whose value is defined as "Mk ". (See id17 and id34.) This is the event ID for the "New" action. This action also needs to know what class to
  • Adobe 65015634 | Scripting Guide - Page 84
    from JavaScript, 75 using from VBScript, 76 actions vs. scripts, 8 working with, 73 Actions palette, 73 active objects, setting, 25 Adobe Photoshop object model, 11, 33 AppleScript conventions, 6 creating, 18 executing JavaScript from, 10 running, 18 unit value considerations, 56 Applescript viewing
  • Adobe 65015634 | Scripting Guide - Page 85
    I images, changing composition, 12 J JavaScript conventions, 6 creating, 19 executing, 10 executing from AppleScript, 10 executing from VBScript, 10 running, 19 support, 10 using Action Manager, 75 workflow automation sample, 60 L layer classes, 12 Layer Comp object defined, 13 relationship to user
  • Adobe 65015634 | Scripting Guide - Page 86
    33 objects Also see individual objects activating, 25 Adobe Photoshop object model, 11 creating in a script, 23 creating, 49 PDF open options object, unit values, 58 Photoshop object model, using, 18 scripting languages example scripts, 17 supported, 9 ScriptListener finding class IDs, 81 finding
  • Adobe 65015634 | Scripting Guide - Page 87
    Index spot color channels, 13 startup scripts, 10 stroking selections, 44 text, 64 styles, applying to layers, 40 Sub Path Item object defined, 14 T text applying color, 64 formatting, 42 layers, 41 stroking, 64 Text Item object creating, 41 defined, 12 formatting text, 42 unit values, 58 working
  • 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
  • 86
  • 87

SCRIPTING GUIDE
ADOBE PHOTOSHOP CS4