Adobe 65014293 Scripting Guide - Page 9
Scripting Support in Photoshop, JavaScript support
UPC - 883919153544
View all Adobe 65014293 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 9 highlights
CHAPTER 2: Photoshop Scripting Basics Scripting Support in Photoshop 9 the size of the selected area in an image: "If the selected area is smaller than 2 x 4 inches, add a green border; otherwise add a red border." ➤ A single script can perform actions that involve multiple applications. For example, depending on the scripting language you are using, you could target both Photoshop and another Adobe Creative Suite 4 Application, such as Adobe Illustrator® CS4, in the same script. ➤ You can open, save, and rename files using scripts. ➤ You can copy scripts from one computer to another. If you were using an Action and then switched computers, you'd have to recreate the Action. ➤ Scripts provide more versatility for automatically opening files. When opening a file in an action, you must hard code the file location. In a script, you can use variables for file paths. NOTE: See Photoshop Help for more information on Photoshop Actions. Scripting Support in Photoshop Photoshop supports scripting in three scripting languages: AppleScript, VBScript, and JavaScript. AppleScript and JavaScript run on Mac OS, and JavaScript and VBScript run on Windows. For information about how to choose which scripting language to use, and for additional information about using these languages with Adobe applications, see Introduction to Scripting. See "Creating and running an AppleScript" on page 18, "Creating and running a VBScript" on page 19, and "Creating and running a JavaScript" on page 19. You can call JavaScript scripts from AppleScript and VBScript scripts. See "Executing JavaScripts from AS or VBS" on page 10. For a file to be recognized by Photoshop as a valid script file it must have the correct file name extension: Script type AppleScript JavaScript ExtendScript VBScript Visual Basic File type compiled script OSAS file text text executable JavaScript support Extension .scpt (none) .js .jsx .vbs .exe Platform Mac OS® Mac OS & Windows Windows Windows For a JavaScript file to be recognized by Photoshop as a valid script file, it must use either a .js or a .jsx extension. On the Mac OS, there is no difference in the way scripts with the two extensions function. On Windows, if the script files is opened from inside Photoshop, there is no difference between using the .js and .jsx extension. However, if the script is launched by double-clicking on it, a script with the .js extension is interpreted with the Microsoft® JScript engine, and it cannot launch Photoshop. For Windows, using the .jsx extension is preferable, since it interprets the script with the ExtendScript engine.