Adobe 23102480 Scripting Guide - Page 9

Executing other scripts, Startup Scripts, Executing JavaScripts from AS or VBS - part number

Page 9 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 9 To install a JavaScript in the Scripts menu, place it in the Scripts folder (Photoshop CS3 /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 CS3 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 CS3 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 CS3\Adobe Photoshop ● On Mac OS, the startup folder for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS3/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 CS3, 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. Photoshop CS3 Object Model A document object model (DOM) is an application programming interface (API), which allows you to programmatically access various components of a document (as defined for that application) through a scripting language. For additional information about Adobe object models and the scripting languages that support them, see Introduction to Scripting. The Photoshop CS3 DOM consists of a hierarchical representation of the Photoshop application, the documents used in it, and the components of the documents. The DOM allows you to programmatically access and manipulate the document and its components. For example, through the DOM, you can create

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

Photoshop CS3
Adobe Photoshop CS3
Scripting Guide
Photoshop CS3 Scripting Basics
9
To install a JavaScript in the Scripts menu, place it in the Scripts folder (
Photoshop CS3 /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 CS3 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 CS3 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 CS3\Adobe Photoshop
On Mac OS, the startup folder for user-defined scripts is:
~/Library/Application Support/Adobe/Startup Scripts CS3/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 CS3, 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
.
Photoshop CS3 Object Model
A document object model (DOM) is an application programming interface (API), which allows you to
programmatically access various components of a
document
(as defined for that application) through a
scripting language. For additional information about Adobe object models and the scripting languages
that support them, see
Introduction to Scripting
.
The Photoshop CS3 DOM consists of a hierarchical representation of the Photoshop application, the
documents used in it, and the components of the documents. The DOM allows you to programmatically
access and manipulate the document and its components. For example, through the DOM, you can create