Table of Contents

Introduction
Who Should Read This?
How Does It Work?
Download(s)
System and Software Requirements
Adobe Photoshop Reserved Words

Tutorials
Overview
  1. Starting a Flex Project
  2. Hello World Panel
  3. Placing the CSXS Library

  4. Shortcut Buttons Panel
    1. JavaScript
    2. Design the Panel
    3. ActionScript
    4. Photoshop Persistent
    5. CSXS Logger AIR Debugger (Optional)

  5. Setting Up Script Listener

  6. Color Picker Panel
    1. JavaScript
    2. Design the Panel
    3. Find Character ID Code to Register Events
    4. ActionScript
    5. Create Custom Icons

  7. Flickr Search Panel
    1. Design the Panel
    2. Create a Flickr Service
    3. Design a Custom Module
    4. Modify Panel's Properties
    5. Connect on Preferences

  8. Per Layer Metadata Panel
    1. View Metadata
    2. JavaScript
    3. Find Character ID Code to Register Events
    4. Designing the Panel
    5. ActionScript
    6. Using Photomerge
Other Samples
Best Practices
Frequently Asked Questions
Acronyms and Definitions
Links
Adobe® Photoshop® Panel Developer's Guide

Shortcut Buttons Panel: JavaScript

The first part of the Shortcut Buttons Panel is creating a JavaScript file. The JavaScript file will have a function that creates a new document in Adobe Photoshop and a function to close a document in Adobe Photoshop. The JavaScript file will be created using ExtendScript Toolkit. The result is to place the JavaScript file into the Adobe Photoshop Panels folder for the SWF file to communicate with.

Go to Shortcut Buttons Panel's JavaScript API that covers a summary of functions and scripts used.

Instructions:

  1. Open ExtendScript Toolkit.
  2. Go to File > New JavaScript.
  3. Copy the following JavaScript code into the new file:
  4. function addDocument(){
       app.documents.add();
    }
    
    function closeDocument(){ app.activeDocument.close(); }

    Code Walkthrough: The two functions, addDocument and closeDocument, and respective code app.documents.add(); and app.activeDocument.close();, adds a new document and closes a document respectively.

  5. Go to File > Save As....
    1. Under Save As:, type in ShortcutButtons.jsx.
    2. Save the file into the Panels folder under the Adobe Photoshop CS5\Plug-ins\ folder located under:
      • Applications for Macintosh
      • Program Files for Windows
    3. Press Save.
  6. Close ExtendScript Toolkit.
Continue to Design the Panel