John,
Thanks.
I'll try to get some basic examples up here too. I think the docs on Exchange were replaced with a non-read only set. Try downloading them again.
Next Topic: The basic Bridge Scripting Paradigm
Bridge being what it is, the typical usage of a script is to select a set of files, then select a menu item to perform some magic on the selected files.
Scripts, therefore, typically need to create a MenuElement at startup, and then wait patiently for the user to call them.
There are 2 ways scripts get loaded. The first is by placing them in the startup scripts folder. The best way to find the startup scripts folder is to click the button in Preferences.
The other way is via Adobe ScriptManager. Script Manager is shipped with the full Creative Suite. It does what it says, pretty much. Provides a way to control what scripts load at startup and what don't. With ScriptManager installed (in startup scripts), it automatically loads scripts in the Workflow Automation Scritps folder (child of startup scripts for the full CS2 installation) and one other folder that is settable by the user.
The Script Manager also has some nice to have features for scripters. When a user selects a script, the Script Manager displays information provided by the scripter. The information includes stuff like the script's name, description, help, author, website, etc. As a scripter, you should always write your scripts assuming the Script Manager is present and loading your script.
To do this, the minimum script template is:
// first is a target directive - tells the extendscript engine that
// this script should be loaded into bridge. Makes it so that if a
// user opens the script in Bridge, it will load it rather than
// display the raw script in the ESTK
#target bridge
// next - all point products attempt to load all scripts in the
// startup scripts folder, if your's is bridge-only, make sure it
// only loads in bridge by wrapping everything in a condition like
// this
if ( BridgeTalk.appName == "bridge" ) {
// always make a namespace object for your script. Make it something
// that will not likely be something someone else might use. This
// avoids possible name collisions between scripts
myScript = {}; // namespace object for this script
// next ditty is for the Script Manager
try {
myScript.scriptInfo = new ScriptManager.ScriptInfo();
myScript.scriptInfo.set( "name", "My Script" );
myScript.scriptInfo.set( "description", "A Cool Script" );
myScript.scriptInfo.set( "help", "Help text" );
myScript.scriptInfo.set( "author", "Your Name" );
myScript.scriptInfo.set( "company", "Your Company" );
myScript.scriptInfo.set( "copyright", "It's mine and you can't have it );
myScript.scriptInfo.set( "version", "1.0" );
myScript.scriptInfo.set( "date", "06-27-2005" );
myScript.scriptInfo.set( "website", "http://www.adobe.com" );
} catch ( e ) {
}
// Your Script Goes HERE.
myScript.ui = function( menu ) {
// this function puts up any UI your script needs, then executes
// the script
}
// create your menu
var menu = MenuElement.create( "command", "My Menu", "at the end of Tools", "tools/myScript" );
menu.onSelect = myScript.ui;
// the last thing for the Script Manager - after your script has
// loaded, send the script info object to it.
try {
ScriptManager.reportLoading( myScript.scriptInfo );
} catch ( e ) {
}
} // closing brace for the if (appName == bridge) condition