Adobe ExtendScript Toolkit

ExtendScript ToolKit

# Shows Class Reference

## Detailed Description

Shows how to communicate with a ScriptUI FlashPlayer using ActionScript communicate with a ScriptUI FlashPlayer using ActionScript

Shows how to load and run a Flash movie using the ScriptUI FlashPlayer.

Shows how to pass a scripting DOM object from Adobe Photoshop CS4 to the ExtendScript toolkit in a BridgeTalk message.

Shows how to use a resource specification to build a ScriptUI window.

Shows how to create a ScriptUI window using a code-based method.

Shows how to use a tree-view list element, and how to capture events with either callback functions or script-registered event listeners.

Shows how to use a slider ScriptUI component.

Shows how to use a progress bar ScriptUI component.

Shows how to create a basic ScriptUI dialog.

Shows how to pass a custom JavaScript object using ExtendScript to another application (Adobe Photoshop CS4) in a BridgeTalk message, and pass it back in a response.

Shows how to send one or more files from ESTK CS4 to Adobe Photoshop CSS to be saved in PNG format.

Shows how to use the cross-DOM to open a file in Adobe Photoshop.

Shows how to use the Socket object to send emails with attachments using ExtendScript.

Shows how to use graphic objects to customize the drawing of ScriptUI elements.

See also:
  SnpCreateFlashControl

Constructor.

use graphic objects to customize the drawing of ScriptUI elements.

#### Usage

1. Open this file and run it in the ExtendScript Toolkit. You can choose as the target any application that supports ScriptUI.
2. Move the sliders up and down to change the color of the top panel.

#### Description

Changes the colors of ScriptUI components dynamically, using the graphics customization objects. Displays sliders that allow the user to set the RGB components of a color, then creates new Pen and Brush types using those colors with methods of the ScriptUIGraphics objects associated with the window and panels.

To make the change in how the colors are drawn into the window on the screen, the example places the new Pen and Brush objects into the appropriate color properties of the graphics objects. The Pen is used to change the foreground, and the Brush is used to change the background.

Each Pen and Brush object is created with a brush type, a color value, and a line width. The color is given as an array of RGB values with a fourth number representing the Alpha channel (transparency) value. The range for all values is 0 to 1. For example, to set the background color of a window to a light grey:

    graphicsObject.backgroundColor = graphicsObject.newBrush (g.PenType.SOLID_COLOR, [0.75, 0.75, 0.75, 1], 1);

See the JavaScript Tools Guide for more details.

Constructor

use the Socket object to send emails with attachments using ExtendScript.

#### Usage

You must edit the mailserver settings within this code; the code as shipped does not provide any default values for these settings and if you do not edit these settings in the code (see "NOTE" below), then the code will not run correctly.

1. Customize the email settings in the code to match your mail system and user accounts; look for NOTE below.
2. Run the snippet in the ExtendScript Toolkit (see Readme.txt).
3. Inspect the JavaScript console for confirmation of the email being sent.
4. Check your email client for the arrival of an email with attached files.

#### Description

This example uses the Socket object to send an email with multiple attachments, by writing to an SMTP server. Attachments are sent as binary data, encoded into Base64 encoding.

This sample sends a single email message at a time, and blocks the main thread until the message has been sent. You should select small files (under 100Kb) to send. For a non-blocking example, suitable for sending larger files, see BackgroundEmailer.jsx available in the Bridge SDK samples

Note that this sample is a demonstration of a technique; it may not run as expected with all mail servers, and is not intended to be a robust mail client.

See also:
  BackgroundEmailer sample available with the Bridge SDK

Constructor.

use the cross-DOM to open a file in Adobe Photoshop.

#### Usage

1. Open the snippet in the ExtendScript Toolkit (see Readme.txt).
2. Make sure Adobe Photoshop CS4 is running
3. When you execute the snippet, you should find the file opened in Photoshop.

#### Description

The image file in the resources folder will be opened in Photoshop.

Constructor.

send files from ESTK CS4 to Adobe Photoshop CS4 to be saved in PNG format.

#### Usage

1. Make sure you have Adobe Photoshop CS4 running
2. In ExtendScript Toolkit set Target to any application that supports ScriptUI
3. The image file 'SaveAsDifferentFileType.jpg' should be located in <extendScriptroot>/sdksamples/resources/.
4. Run this snippet
5. You should see a PNG image file created from the original image described above, located in the resources folder. The PNG image filename should begin snp... and match the first part of the image filename originally selected; for example, if you chose image- so if you chose myImage.psd, the output file would be snpmyImage.png.

#### Description

Uses interapplication messaging to send files from your chosen application to Photoshop to be saved in PNG format. When Photoshop receives the message, it begins processing the file.

Constructor

pass a custom JavaScript object using ExtendScript to another application (Adobe Photoshop CS4) in a BridgeTalk message, and pass it back in a response.

#### Usage

1. Make sure Adobe Photoshop CS4 is running
2. Run the snippet in the ExtendScript Toolkit (ESTK).
3. Inspect the JavaScript Console in the ESTK for information on the sequence of messages and objects passed.
4. Note; there is no other visible output besides the trace to the JavaScript Console of the ESTK.

#### Description

ExtendScript sends a BridgeTalk message to Photoshop, passing a JavaScript object. Photoshop reconstructs and modifies the object, then serializes the object and returns it as the result of the initial message.

In processing the result, ExtendScript evaluates the serialized object in order to reconstruct it.

Constructor

create a basic ScriptUI dialog.

#### Usage

1. Run the snippet in the ExtendScript Toolkit (see Readme.txt). This snippet can run in any application that supports ScriptUI.
2. A dialog appears, which emits trace statements to the JavaScript console to indicate which button was pressed.

#### Description

Creates and shows a simple ScriptUI modeless dialog (also called a palette) with OK/Cancel buttons and event listeners that implement the button behavior.<br ./>

Constructor.

use a progress bar ScriptUI component.

#### Usage

1. Open this file and run it in the ExtendScript Toolkit. You can choose as the target any application that supports ScriptUI
2. Press Start in the displayed dialog and watch progress bar update
3. Press Reset to return the progress bar to its initial state

#### Description

Creates a dialog containing a progress bar, a button that updates its value periodically, and another button that resets the progress to 0.

Constructor.

use a slider ScriptUI component.

#### Usage

1. Open this file and run it in the ExtendScript Toolkit. You can choose as the target any application that supports ScriptUI
2. Move the slider in the displayed dialog and watch the label update.

#### Description

Creates a dialog containing a slider and a text component. The current value is reflected in the text.

Constructor.

use a tree-view list element, and how to capture events with either callback functions or script-registered event listeners.

#### Usage

1. Run the snippet in the ExtendScript Toolkit (see Readme.txt).
2. Expand and collapse the list elements
3. Inspect the JavaScript Console to see the captured events from the TreeView elements.

#### Description

Creates two TreeView hierarchical list components. One is static, with a fixed set of item nodes that you can expand and collapse. The other is dynamic; item nodes are added and removed as as needed to show a view of the filesystem.

The list items in the TreeView use custom images to display folders and files. When adding items to the TreeView list, the type 'item' is used for leaf elements and 'node' for container elements.

The dynamic TreeView captures events in two different ways. It uses callback functions to capture the node expand and collapse events and selection changes, and also registers an event listener to capture double-click events.

Constructor

create a ScriptUI window using a code-based method.

#### Usage

1. Open this file and run it in the ExtendScript Toolkit.
2. You can choose as the target any application that supports ScriptUI.
3. You should see a dialog with a variety of ScriptUI components.

#### Description

Demonstrates the use of the Window and container add() methods, building a simple palette (a modeless or floating dialog) containing an assortment of components.

See also:
  AlertBoxBuilder1

  AlertBoxBuilder2

  SnpCreateUIAddMethod

Constructor.

use a resource specification to build a ScriptUI window.

#### Usage

1. Run the snippet in the ExtendScript Toolkit (see Readme.txt).
2. You can choose as the target any application that supports ScriptUI.
3. You should see a dialog with a variety of ScriptUI components.

#### Description

Creates a resource-specifications string that defines the contents for a simple palette (a modeless or floating dialog). The contents are an assortment of user-interface components, the same ones that are created individually with the add() method in SnpCreateUIAddMethod.jsx.

See also:
  AlertBoxBuilder1

  AlertBoxBuilder2

  SnpCreateUIAddMethod

Constructor.

pass a scripting DOM object from Adobe Photoshop CS4 to the ExtendScript toolkit in a BridgeTalk message.

#### Usage

1. Make sure Adobe Photoshop CS4 is running
2. Run the snippet in the ExtendScript Toolkit
3. Inspect the JavaScript Console in the Toolkit to see information about the messages and objects passed between the applications.
4. Note; there is no other visible output besides the trace to the JavaScript Console of the ESTK.

#### Description

Demonstrates passing a DOM object from Adobe Photoshop CS4 to Adobe ExtendScript toolkit via BridgeTalk. The passed script within the BridgeTalk message creates a File instance and then serialises it with toSource(). When the ESTK receives the BridgeTalk message response, it can access the DOM object created by Adobe Photoshop and its properties by using eval() on the 'resObj.body' which is returned to the callback function BridgeTalk.onResult().

Constructor

load and run a Flash movie using the ScriptUI FlashPlayer

See also:
  FlashDemo

Constructor

The documentation for this class was generated from the following file:

- ActionScriptDemo.jsx

Copyright© 2008 Adobe Systems Incorporated. All rights reserved.

Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks