Adobe 23101764 Scripting Guide - Page 9
JavaScript, 7 Choosing a scripting language
UPC - 718659340025
View all Adobe 23101764 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 9 highlights
Introduction 1 JavaScript 1.6 JavaScript In addition to writing AppleScripts and Visual Basic scripts, you can also write cross-platform JavaScripts (using the text editor or your choice) on either the Mac or Windows platform. Photoshop provides a built-in, platform-independent framework for executing JavaScripts. The easiest way to run your JavaScripts is to use the "File>Scripts" menu. JavaScripts are stored in or accessed through the Scripts folder. Scripts folder The Scripts folder is located in the "Presets" folder of your Photoshop installation. All JavaScript files placed in the Scripts folder are available for execution from the Scripts menu. On both Mac and Windows, JavaScript files must be saved as text files with a '.js' file name extension. For more information on the JavaScript scripting environment, see Section 3.2.3, "Viewing the JavaScript Environment. 1.7 Choosing a scripting language Your choice of scripting language is determined by two trade-offs: 1. Do you need to run the same script on both Macintosh and Windows computers? 2. Do you need to control multiple applications from the same script? As mentioned earlier, JavaScript is a cross-platform language that works on either platform. The same script will perform identically on Windows and Macintosh computers. However, JavaScript is invoked from the Scripts menu within Photoshop and lacks the facilities to directly address other applications. For example, you cannot easily write a JavaScript to manage workflows involving Photoshop and a database management program. AppleScript and Visual Basic are only offered on their respective platforms. However, you can write scripts in those languages to control multiple applications. For example, you can write an AppleScript that first manipulates a bitmap in Photoshop and then commands a web design application to incorporate it. This same cross-application capability is also available with Visual Basic on Windows. You may also use other scripting languages when working with Photoshop. On Mac OS, any language which lets you send Apple events can be used to script Photoshop. On Windows, any language which is COM aware can be used to script Photoshop. Photoshop CS Scripting Guide 5