Adobe 65009963 Scripting Manual page 7

After effects cs4
Table of Contents

Advertisement

Overview
The Window menu and ScriptUI Panels folder
Within the Scripts folder, you can create another folder named ScriptUI Panels. Use this folder for scripts
whose user interface appears in a native panel (as opposed to a floating palette, dialog box, or window). The
advantage of a panel is that it can be docked with other panels, such as Project, Composition, and Time
Controls, and appear more integrated into the application. Like native panels, ScriptUI Panels scripts are
accessed from the Window menu.
Instead of creating a Window object an adding controls to it, a ScriptUI Panels script uses the "this" object that
represents the panel. For example, the following code adds a button to a panel:
va r myPane l = t his;
myPane l.add("bu tt on", [10 , 10, 100 , 30 ], "T ool #1 ") ;
m y P an e l .s ho w ( );
If your script creates its user interface in a function, you cannot use "this" as it will refer to the function itself,
not the panel. In this case, you should pass the "this" object as an argument to your function. For example:
f u n c t io n c r e a teU I ( th is O b j) {
va r myPane l = t hisO b j;
myPane l.add("bu tt on", [10 , 10, 100 , 30 ], "T ool #1 ") ;
re t u r n m y P an el ;
}
v a r m y T o o l s P a n e l = c r e at e U I ( t h i s ) ;
m yT o o l sP an e l .sh ow ();
You cannot use the File > Scripts > Run Script File menu command to run a script that refers to "this". To
make your script work with either a Window object (accessible from the File > Scripts menu) or a native panel
(accessible from the Window menu), check whether "this" is a Panel object. For example:
f u n c t io n c r e a teU I ( th is O b j) {
v a r m y P an e l = ( th is O b j i n st an c e o f P a n e l ) ? t h i s O b j : n e w W i n d o w ( " p a l e t t e " , " M y T o o l s " ,
[100 , 10 0, 3 00, 3 00]);
myPane l.add("bu tt on", [10 , 10, 100 , 30 ], "T ool #1 ") ;
re tu r n m y P an e l;
}
v a r m y T o o l s P a n e l = c r e at e U I ( t h i s ) ;
m yT o o l s P an e l .sh ow ();
Sending a script to After Effects from the system
If you are familiar with how to run a script from the command line in Windows or via AppleScript, you can
send a script directly to the open After Effects application, so that the application automatically runs the script.
How to include After Effects scripting in a command line (Windows)
Following are examples of Windows command-line entries that will send an After Effects script to the appli-
cation without using the After Effects user interface to execute the script.
In the first example, you copy and paste your After Effects script directly on the command line and then run
it. The script text appears in quotation marks following the
a ft erf x .ex e -s " a le rt (" Y o u j us t s en t an al e rt t o Af t er E f f ec ts " ) "
Sending a script to After Effects from the system
command:
a ft erf x .e xe - s
7
7

Advertisement

Table of Contents
loading

This manual is also suitable for:

Creative suite 3 after effects

Table of Contents