Adobe.js | JavaScript: Behavioral Layer

Standards Based Development

Flex

Accessing Flex from JavaScript

Creative Suite

Creative Suite Extensions are air applications with a select group of libraries from the Creative Suite sdk.

JavaScript and ActionScript (Flex container) communicate through a sandbox bridge, which permits safely isolating both domains and treats objects and methods on the other side as if they're not from another language.

JSX scripting makes controlling Photoshop easy after installing the Scripting Listener plugin; Photoshop logs everything performed as code to "ScriptingListenerJS.log".

The code logged in the "ScriptingListenerJS.log" can (SHOULD) be extracted, wrapped into a function, dropped into a .jsx file, and executed with as3 using evalScript, like so:


var restul; SyncResult = CSXSInterface.instance.evalScript('jsxFunction');

Passing arguments is supported, however cs4 supports only one argument; cs5+ has problems with non-alphabetic/numeric characters, passing strings with them will result in PlugPlugRequestFailed result.

Overcome these limitations in cs4/cs5+ by simply serializing and encoding the arguments (hexadecimal) in as3, finally decoding then in the JSX script.

Using Flash Builder along with the Extension Builder plugin is the conventional method of compiling Creative Suite Extensions. create suite extension is a build tool for Adobe Creative Suite extensions repository.

Sandbox Bridges

Building on air: Working with the Sandbox Bridges

Adobe Creative Suite Scripting

References and Resources

adobe.js JavaScript

adobe.js files have that run on Windows and OS X have a .jsx file extension: your-mom.jsx

adobe.js Applescript

Applescript files are OS X only, and have a .as or .scpt file extension: your-moms-applescript.as or your-moms-other-applescript.scpt

adobe.js Visual Basic

adobe.js files are Windows only and have a .vbs file extension: your-moms-visual-basic.bcs

adobe.js Applescript

Applescript Demo: Build a daily todo-list in html

Example's source code.

References and Resources

Adobe JavaScript JSX File Icon (Adobe JavaScript) ExtendScript Toolkit Icon

ExtendScript Toolkit Iconestk (ExtendScript Toolkit)

The estk 3.5 is a development and debugging tool for JavaScript scripts included with Adobe Creative Suite 5 and applications such as Bridge, Photoshop, Illustrator, InDesign, and After Effects. The estk 3has many features that make it easier to use than a text editor, including a built-in syntax checker that identifies where the problems are in your script and tries to explain how to fix them, and the ability to run your scripts right from the estk 3without saving the file.

The estk 3also includes a JavaScript debugger that allows you to:

  • Single-step through JavaScript scripts (JS or JSX files) inside an application
  • Inspect all data for a running script
  • Set and execute breakpoints

estk 3 3.5 contains a number of improvements related to its usability and stability, including:

  • Automatic document backup
  • Option to open new documents in a floating window
  • Option to display the Object Model Viewer in a dockable window
  • Fast access to clear the Console pane
  • Improved output of debugging sessions
If you are using Adobe’s own ExtendScript Toolkit Editor, you can find an Object Model Viewer under the Help menu. Alas, it requires quite some work to find your way around it. First, you need to select your version of InDesign in the “Browser” dropdown list before you can use it; then you can enter “zoom” in the Search field, and you get this: I clicked “LayoutWindows.zoom()” because I had an inkling of what I was looking for – a method named ‘zoom’ – but it appears it’s the wrong one, because if you select “ZoomOptions” in the data card, you get this: which somehow does not tell you what you wanted to know. Only if you look up “ZoomOptions” (somewhere else!), you will find that these options are those of the View menu: Actual Size, Fit Page, Fit Spread, Show Pasteboard, and Zoom In and Out. Frustrating! We actually need the entry above it: the property named “LayoutWindow.zoomPercentage”: What is this “LayoutWindow” thing? Enter it in the Search field and you can see it’s part of the Application or a Document, and in this case we can use the Application entry under its usual name “app”. Apart from being quite clumsy to work with, an obvious drawback of this help system is you have to use the ESTK to write your scripts with, where I prefer a plain text editor (TextPad on my PC, TextWrangler on my Mac; but you can use Notepad or TextEdit – in plain text mode – as well). Fortunately you don’t have to use ESTK — all of this information is actually stored in a file deep inside InDesign’s data folders, and it’s possible to rewrite it to a more convenient format. So I’ve done that for you! Originally, I used XSLT to reformat the original XML into HTML; soon after that, another scripter named ABC Green showed me how to compile it into a single, convenient Windows Help file. This file is fully hyperlinked, lists how objects are used in functions, and provides graphic representations of the relations between them:

References and Resources

Adobe Bridge

Adobe Bridge cs4 sdk

Adobe Bridge CS4 SDK

The Adobe Bridge SDK, which is updated for CS4, enables developers to integrate with and extend Bridge. This SDK shows developers how to program with the JavaScript API to Bridge, and how to develop plug-ins (external libraries) for Bridge in C/C++ and call this code from JavaScript. The external object mechanism can be used to write plug-ins for Adobe Creative Suite 4 applications that have integrated ExtendScript, an Adobe JavaScript implementation. The October, 2008 update contains information on new and enhanced features such as the Collections feature (new in Adobe Bridge CS4), allowing users to create arbitrary named collections of thumbnails. Also detailed are changes to the Menus and Preferences dialog and a new optional preference that allows you to specify whether an embedded color space should be preserved when creating a BitmapData object. The Web Access library, which was previously documented in the JavaScript Tools Guide, is now available only through Adobe Bridge, and is documented in the Adobe Bridge CS4 JavaScript Reference. Adobe Bridge CS4 SDK Adobe Bridge CS4 SDK Readme (TXT) Readme (TXT) The following folders and files are contained within the Bridge SDK: BRIDGE-SDK/sdksamples/javascript: JavaScript code snippets and sample scripts, which exercise the scripting interface of Adobe Bridge CS4. BRIDGE-SDK/sdksamples/cpp: Sample project files, C/C++ source code and sample scripts for building and loading an external object, which is an external library that can be called from JavaScript within Bridge and some of the other point products in Creative Suite BRIDGE-SDK/docs: contains resources such as the Adobe Bridge CS4 JavaScript Reference and the Adobe Bridge CS4 JavaScript Guide.

References and Resources

.jsx File Extension

ExtendScript is the formal name for Adobe JavaScript.

.jsx is JavaScript text. On Mac OS, either file type is treated the same. On Windows, either type is treated the same too if you run your script from within Photoshop. But if you run your script outside of Photoshop by double-clicking on it or through other means, a *.js file will be interpreted by the Microsoft built-in JScript engine while a *.jsx file will get run by Adobe's ExtendScript engine. Only ExtendScript can access the goodies Adobe added to the basic JavaScript language. As such, it is preferable to stick with the *.jsx ending to ensure you get the desired results.

After Effects

References and Resources

Photoshop

References and Resources

Illustrator

Scriptographer is a scripting plugin for Adobe Illustrator™. It gives the user the possibility to extend Illustrator’s functionality by the use of the JavaScript language. Scriptographer has been replaced by paper.js.

References and Resources

Acrobat

References and Resources

InDesign

InDesign Scripting Forum

adobe.js can be installed into InDesign in two places: application folder and user script folder:

  1. Open up Scripts Panel - (Window > Automation > Scripts in CS3 and CS4; or Window > Utilities > Scripts in CS5 or later)
  2. Right Click on Application or User
  3. In the context menu, select Reveal in Windows Explorer/Reveal in Finder
  4. A folder should open, and Scripts Panel should be a folder within
  5. adobe.js Scripts go in the Scripts Panel
  6. Open a document to run a script; after its opened, open Scripts Panel and double-click on the script desired. If this action fails, the script probably requires the user to make a selection in InDesign first, because the script is written to act on a selection.

    Script Bay

    Script Bay is a complete redesign of Scripts Panel, as a plugin, free and downloadable here, however it is only for cs5 and up.

    Adobe Drive

    Adobe Drive Adobe Drive is an application that allows one to connect the following CS applications (InDesign, Illustrator, Photoshop and/or InCopy) to a DAM (digital asset management) system. Having an Adobe Drive integration provides full access to content on a DAM system from Adobe Bridge, the Explorer or Finder and includes the ability to check in, check out, add check in comments, compare versions etc. from directly within the supported CS applications. - See more at: http://blogs.adobe.com/cssdk/#sthash.bE6Q0CPW.dpuf.

    References and Resources

Controlling Photoshop is easy with JSX scripting. With the Scripting Listener plugin installed, Photoshop logs all actions performed as code to "ScriptingListenerJS.log". If taken, wrapped in a function, and dropped in your project's *.jsx file, the code can be executed from AS3 using evalScript: How We Built a Photoshop Extension with html, css, and js adobe.js Installing and using the ScriptingListener plug-in Jeff Tranberry's Digital Imaging Crawlspace Photoshop Scripting Posts