Pelco Server C1553M-B User Manual

Page of 258
C1553M-B (4/05)
203
Global Scripts
Global scripts are scripts that can be run from other scripts using the RUN or CALL command. This distinguishes them from the scripts associated 
with labels, hotlinks, timers, prompts, and alarms and events, which cannot be run from other scripts. If there is an action you want performed by 
more than one script, define the action in a global script and call it from the other scripts as needed.
Global scripts can also be run directly from a custom window in the client, provided the operator has permission. When you create a user group, 
if you check the permission for a particular global script, then operators who log in under that user group can run the global script. Refer to User 
Groups - Group Permissions
 for more information on permissions. For information on how an operator runs a global script from a custom window, 
refer to Custom Windows in the VMX300(-E) Client Operation Manual. 
Local Variables: The VMX300(-E) scripting language has local Boolean variables that are declared in a script’s DIM or VAR statement. They are 
local in the sense that they can be accessed only within the script that declares them, as well as from any global script the script calls using the 
CALL command. They cannot be accessed from a global script run using the RUN command. Any script, global or local, can declare local 
variables.
ADD A NEW GLOBAL SCRIPT
1. Navigate the Object Browser to [project name] > Global Scripts. Double-click <Add New Global Script> in the right pane, or right-click 
Global Scripts in the left pane and select Add New from the pop-up menu. The Add New Global Script dialog box opens.
Figure 226.  Add New Global Script Dialog Box
2. Name: Type in a unique, descriptive name for the global script you want to create. Script names are at most 50 characters long and can 
include any letter, digit or special character, with the exception of single and double quotation marks. Script names are not case sensitive. 
A tag resembling the name appears in the Script Tag box. If the name contains special characters, they are omitted from the tag. Spaces 
are replaced with underscores. Leading digits are removed.
3. Script tag: If you do not want to use the script tag provided by the server, type in a unique, meaningful tag. Script tags are at most 50 
characters long. They can include any letter, digit or the underscore character, but cannot begin with a digit. They cannot contain spaces or 
special characters. Tags are not case sensitive. Use the script tag to refer to the global script in other scripts.
4. Action: Type the script action directly into the Action column, or use the script wizard to help you write the script. For more information on 
5. Click OK. The Add New Global Script dialog box closes and the new global script is created. The name and script tag of the new global 
script appear in the right pane of the Object Browser.
NOTE:  When you edit a global script, make it available in its updated form by saving the server configuration before attempting to run the 
script.
TIP:  A global script that is run from another script can access local variables declared in the calling script. The calling script must CALL, not 
RUN, the global script.