Adobe 65014293 Scripting Guide - Page 10
Executing other scripts, Startup scripts, Executing JavaScripts from AS or VBS - photoshop
UPC - 883919153544
View all Adobe 65014293 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 10 highlights
CHAPTER 2: Photoshop Scripting Basics Scripting Support in Photoshop 10 Scripts written in JavaScript can be accessed from the Adobe Photoshop Scripts menu (File > Scripts), which provides quick and easy access to your JavaScripts. By putting a JavaScript file into the appropriate location on disk, it can be accessed directly from the Photoshop menu. To install a JavaScript in the Scripts menu, place it in the Scripts folder (Photoshop CS4 /Presets /Scripts). The names of the scripts in the Scripts folder, without the file name extension, are displayed in the Scripts menu. Any number of scripts may be installed in the Scripts menu. Scripts added to the Scripts folder while Photoshop is running do not appear in the Scripts menu until the next time you launch the application. All scripts found in the Scripts folder and sub-folders are displayed at the top level of the File > Scripts menu. The addition of sub-folders does not add a hierarchical organization to the Scripts menu. Executing other scripts The Browse item at the end of the Scripts menu (File > Scripts > Browse) allows you to execute scripts that are not installed in the Scripts folder. You can also use Browse to select scripts installed in the Scripts folder after the application was last launched. Selecting Browse displays a file browser dialog which allows you to select a script file for execution. Only .js or .jsx files are displayed in the browse dialog. When you select a script file, it is executed the same way as an installed script. Startup scripts On startup, Photoshop executes all .jsx files that it finds in the startup folders. ➤ On Windows, the startup 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 also executed by all other Adobe Creative Suite 3 applications at startup. If such a script is meant to be executed only by Photoshop, it must include code such as the following: if( BridgeTalk.appName == "photoshop" ) { //continue executing script } For additional details, see the JavaScript Tools Guide. Executing JavaScripts from AS or VBS You can take advantage of JavaScript's platform-independence by running scripts from AppleScript or VBScript. You can execute either a single JavaScript statement or a complete JavaScript file. For more information, please refer to Introduction to Scripting.