Programming Guide (JScript)



Yüklə 6,96 Mb.
Pdf görüntüsü
səhifə17/22
tarix07.11.2018
ölçüsü6,96 Mb.
#78683
1   ...   14   15   16   17   18   19   20   21   22

69
6.  
7.  
8.  
In the 
 window, open the
 list and select the
 object.
Editor-Debugger
 Script Debug/Edit
 Script 2
Enter the following in the 
 field:
Script
 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");
}


70
8.  
9.  
10.  
11.  
12.  
In the 
 menu, select
 to save the script.
File
 Save to database
Create a test event to run the script in debug mode – “MACRO|1|RUN|”. To achieve this, in the
 menu, select 
; the 
 window will 
 Debug and edit
Edit test event
Test message
open. Fill in the fields in the 
 window as shown in figure.
Test message
To run the script with the test event, select
 in the 
 menu.
 Test run
Debug and edit
Open the 
 list and select 
. The debugger window will open at the right side.
Script Messages
Script 1


71
12.  
13.  
In the debugger 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”.
The error message says that there is no identifier in the second line of variable declaration operator (var). That means no variable has been declared. This is a critical error in 
JScript, thus the script has not been executed.
Change the text of the script (see the “var i;” line).
 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");
  }


72
13.  
14.  
15.  
16.  
17.  
18.  
19.  
DebugLogString ("Hello world");
}
In the 
 menu, select 
 to save the script.
File
Save to database
Repeat steps 10 and 11.
In the debugger 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” 
means that the script runs correctly in the debug mode.
Close the
 utility.
 Editor-Debugger
The text of the created script will be shown in the 
ield of the 
 object settings panel. Click the 
 button in the 
 settings panel to activate the script.
Script f
Script 1
Apply
Script 1
Select 
 in the 
 menu of the main control panel.
Macro 1
Run


73
20.  
21.  
In the debugger window of the
 system, check that the macro and the script have run successfully.
 Intellect
Check the accuracy of the script result. The 
 in the 
 to 
 object settings panels should read “10”.
Hot recording field
Camera 1
Camera 4
Script creation and debugging is now complete.
Script debugging
Script debugging features
Note
The
 in the 
 settings panel is empty by default
 Hot recording field
Camera


74
1.  
2.  
3.  
4.  
1.  
The 
 utility allows debugging scripts using the built-in tools for checking script syntax, script interpreting and script execution with test events generated by the utility. 
Editor-Debugger
The messages about the debugging results are displayed in the corresponding debugger windows.
The 
 utility provides the following debugging functionality:
Editor-Debugger
A separate debugger window is assigned to each Script object, where the test and system events, error messages, success messages and user information messages are 
displayed. The messages in the debugger windows can be filtered.
Special Information window debugger windows are available for displaying the messages related to the script being debugged.
Test events generated by the 
 utility, which are not registered by the Intellect system, are used for checking script accuracy.
Editor-Debugger
Third-party debugger programs can be used for step-by-step execution, viewing script variables during execution, and other functionality.
Creating and using test events
Creating test events
The 
 utility is capable of generating test events chosen by the user to help debug the scripts. Test events are not registered by the video surveillance system, i. e. they 
Editor-Debugger
are not listed in the events log and not saved to the database.
No more than one test event can be created for each script.
To create a test event, do the following:
In the 
 menu, select
, or click the 
 button in the toolbar.
Debug and edit
 Edit test event


75
2.  
3.  
1.  
2.  
3.  
4.  
5.  
4.  
The Test message window will open. 
This window is used for entering the test event parameters.
Enter the following information in the fields of the Test message window:
SourceType – object type;
SourceId – object identification number;
SourceAction – the event generated by the specified object;
param – additional event parameters;
value – values of the additional parameters.


Yüklə 6,96 Mb.

Dostları ilə paylaş:
1   ...   14   15   16   17   18   19   20   21   22




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə