...
- In the Hardware tab of the System Settings dialog window window, create four four Camera objects with identification numbers 1, 2, 3, and 4 , if they have not been created before.
- In the Programming tab, create a Macro object with identification number 1. Don't fill in the Events table for the correct execution of the following actions and successful run of the script.
- In the Programming tab, create a Script system object. Give the object the identification number 1 and the name "Script 1".
- On the settings panel of the Script 1 object, select Always from the Time schedule drop-down list.
- Click the Editor-Debugger button at the bottom of the settings panel of the Script 1 system object. The Editor-Debugger utility window will openopens.
- In the Editor-Debugger utility window, open the Debug-edit script list and select the Script 2 object.
Image Removed
Image Added In the Script field, enter the following:
| Code Block |
|---|
|
if (Event.SourceType == "MACRO" && Event.SourceId == "1" &&
Event.Action == "RUN")
{
var ;
for(i=1; i<=4; i=i+1)
{
SetObjectParam("CAM",i,"hot_rec_time","10");
}
DebugLogString ("Hello world");
} |
| Note |
|---|
|
The script contains an error. See below the recommendations on how to fix it. |
- In the File menu, select Save to database to save the script.
- Create a test event to run the script in debug mode—MACRO|1|RUN|. To achieve this, in the Debug and edit menu, select Edit test event. The Test message window will openopens. Fill in the fields in the the Test message window as shown in the figure.
Image Removed
Image Added - To run the script with the test event, select Test run in the Debug and edit menu.
- Open the Script Messages list and select Script 1. The debugging window will open opens on the right side.
- In the debugging window, find the “Process Event:MACRO|1|RUN|” line and the following error message: “Src identifier missing: Microsoft JScript compilation error Line:2 Char:6 Error:0 Scode:800a03f2”.
Image Removed
Image Added
The error message says that there is no identifier in the second line of the variable declaration operator (var). This means that no variable has been declared. This is a critical error in JScript, thus the script has not been executed.
Correct the text of the script (see the “var i;” line).
| Code Block |
|---|
|
if (Event.SourceType == "MACRO" && Event.SourceId &&
Event.Action == "RUN")
{
var i;
for(i=1; i<=4; i=i+1)
{
SetObjectParam("CAM",i,"hot_rec_time","10");
}
DebugLogString ("Hello world");
} |
- In the File menu, select Save to database to save the script.
- Repeat steps 10 and 11.
- In the debugging window, find the “Process Event:MACRO|1|RUN|” line and the “DebugLogString:Hello world” and “Script first run OK” messages. The “Script first run OK” message means that the script runs correctly in the debug mode.
Image Removed
Image Added - Close the Editor-Debugger utility.
- The text of the created script will be is displayed in the field of the Script 1 system object. Click the Apply button on the settings panel of the Script 1 system object to activate the script.
- Select Macro 1 in the Run menu of the main control panel.
- In the debugging window of Axxon PSIM, check that the macro and the script have run successfully.
Image Removed
Image Added Check the accuracy of the script resultMake sure that the script is executed correctly. The "Hot record" time field in the Camera 1 to Camera 4 objects' settings panels must have the 10 value.
Image Removed
Image Added
| Info |
|---|
|
The "Hot record" time field in the Camera settings panel is of the Camera objects is blank by default. By default, the new script is unavailable for all computers in the distributed system. To make it available, you must set the 0 value for the key ScriptSlavesDefaultNotSelected of the HKEY_LOCAL_MACHINE\SOFTWARE\AxxonSoft\PSIM registry section (see Registry keys reference guide. For information on working with the registry, see Working with Windows OS registry). |
The process of creating and debugging a script is Script creation and debugging is now complete.