Programming Guide (Jscript) : Last Update 04/12/2019
Programming Guide (Jscript) : Last Update 04/12/2019
Last update 04/12/2019
Intellect 4.11.0 (english) – Programming Guide (JScript)
Table of contents
1 Programming in JScript.........................................................................................................6
1.1 JScript functionality in Intellect......................................................................................................... 6
1.2 Description of the JScript object model in Intellect ......................................................................... 6
1.2.1 The Core object and its built-in methods .......................................................................................................... 6
1.2.1.1 The Core object ................................................................................................................................................... 6
1.2.1.2 The SetObjectParam method............................................................................................................................. 6
1.2.1.3 The SetObjectState method............................................................................................................................... 7
1.2.1.4 The DebugLogString method ............................................................................................................................. 8
1.2.1.5 The Base64Decode method ............................................................................................................................... 8
1.2.1.6 The Sleep method............................................................................................................................................... 8
1.2.1.7 The Itv_var method............................................................................................................................................. 9
1.2.1.8 The Int_var method .......................................................................................................................................... 10
1.2.1.9 The GetObjectParentType method.................................................................................................................. 11
1.2.1.10 The GetIPAddress method................................................................................................................................ 11
1.2.1.11 The GetObjectName method ........................................................................................................................... 12
1.2.1.12 The GetObjectState method ............................................................................................................................ 12
1.2.1.13 The GetObjectParam method .......................................................................................................................... 13
1.2.1.14 The GetObjectParentId method....................................................................................................................... 13
1.2.1.15 The DoReactStr method ................................................................................................................................... 14
1.2.1.16 The DoReact method ........................................................................................................................................ 15
1.2.1.17 The DoReactSetupCore method ...................................................................................................................... 16
1.2.1.18 The DoReactSetup method .............................................................................................................................. 17
1.2.1.19 The DoReactGlobal method ............................................................................................................................. 18
1.2.1.20 The NotifyEventStr method.............................................................................................................................. 18
1.2.1.21 The NotifyEvent method................................................................................................................................... 19
1.2.1.22 The NotifyEventGlobal method........................................................................................................................ 20
1.2.1.23 The CreateMsg method..................................................................................................................................... 21
1.2.1.24 The Lock and Unlock methods......................................................................................................................... 22
1.2.1.25 The IsAvailableObject method ......................................................................................................................... 23
1.2.1.26 The GetUserId method...................................................................................................................................... 24
1.2.1.27 The GetEventDescription method.................................................................................................................... 25
1.2.1.28 The GetObjectIdByParam method................................................................................................................... 25
1.2.1.29 The SaveToFile method.................................................................................................................................... 25
– 2
Intellect 4.11.0 (english) – Programming Guide (JScript)
– 3
Intellect 4.11.0 (english) – Programming Guide (JScript)
– 4
Intellect 4.11.0 (english) – Programming Guide (JScript)
– 5
Programming Guide (JScript)
1 Programming in JScript
Method arguments:
1. objtype - required argument. The type of the object whose parameters are to be set. It takes the following values: Type –
String, range – existing object types.
2. id - required argument. Identification number of the object of the type set in the objtype parameter. It takes the following
values: Type – String, range – existing object identification numbers of the specified type.
3. param - required argument. The parameter of the object. It takes the following values: Type – String, range – available
parameters of the object.
4. value - required argument. The value to be set for the parameter specified in the param argument. It takes the following
values: Type – String, range – depends on the parameter.
Usage examples
Example. When Macro 1 starts, check if Cameras 1 to 4 are set to broadcast color video. If a camera is set for black-and-white
video broadcast, then switch it to the color mode (setting the true (“1”) value to the “Color” parameter – (“color”)).
Note
If the object is active when the script is started (i.e. the setting panel of this object is open), then object parameters can
not be changed by the SetObjectParam method. For instance, if the setting panel for the Camera 1 object is open and
the aforecited script is started, the operation mode of Camera 1 will not be changed for the color one.
Method arguments:
1. objtype - Required argument. The type of the object whose state is to be changed. It takes the following values: Type –
String, range – existing object types.
2. id - Required argument. Identification number of the object of the type set in the objtype parameter. It takes the following
values: Type – String, range – existing object identification numbers of the specified type.
3. state - Required argument. The state to switch the object to. It takes the following values: Type – String, range – available
states of the object.
Usage examples
Example. Check if Camera 1 is armed every hour. If Camera 1 is disarmed, arm it.
Note
The Timer object with identification number 1 should be created beforehand. Set the Minutes parameter of the Timer
object to 30.The timer would go off every hour at half past the hour - 09:30, 10:30, 11:30, etc.
Method arguments:
output - Required argument. The text message to be displayed in the debug window of the Editor-Debugger utility. It takes the
following values: Type – String.
Usage examples
Problem. Output to the debugger window all microphone events registered by the system.
if (Event.SourceType == "OLXA_LINE")
{
var msgstr = Event.MsgToString();
DebugLogString("Event from the microphone " + msgstr);
}
Method arguments:
1. data_in - required argument. Set a line that should be decoded in Base64;
2. WideChar - required argument. Determines coding type. Can take 0 or 1 values. If coding type is Unicode, argument value
is 1, otherwise 0.
Usage examples
Decode the line that is set in Base64 by starting macro №1. Output the decoding result into the debug windows of the Editor-
Debugger utility. (Result is « Intellect JAVA SCRIPT» line).
Method arguments:
milliseconds - Required argument. The length of time that the script will be inactive for. Set in milliseconds. It takes the following
values: Type – int.
Usage examples
Problem 1. When Macro 1 starts, play the following audio files one by one: cam_alarm_1.wav, cam_alarm_2.wav,
cam_alarm_3.wav from the …\Intellect\Wav\ folder. Set a 5 seconds (5000 milliseconds) delay before starting each subsequent
file.
Problem 2. When macro №2 starts, timer №1, that triggers every 10 seconds in a minute after macro №2 starting, starts.
Note
To start this script create the Timer object with ID=1 beforehand. Leave object parameters set by default (Any). The
Timer 1 object can be disabled
Method arguments:
globalvar - Required argument. The name of the global variable. It takes the following values: Type – String, satisfying the rules
for the names of the string parameters in the Windows registry.
Global variables are stored in the Windows registry to maintain their values after Windows restart. All global variables are stored
in the registry branch HKEY_USERS\S-1-5-21-…\Software\ITVScript\ITVSCRIPT and HKEY_CURRENT_USER\Software\ITVScript\
ITVSCRIPT. To access a global variable directly from the registry, search the registry for it by its name.
Usage examples
Problem. When Macro 1 starts, save the value of the bright parameter of Camera 10 to the cam10bright global variable. When
Macro 2 starts, set the bright parameter of Cameras 1 to 4 to the value of the cam10bright global variable.
Attention!
The Int_var method uses the same storage as the Itv_var method, but modify the type of variable to the integer type.
Method arguments:
1. globalvar – required argument. The name of the global variable. It takes the following values: type – String, satisfying the
rules for the names of the string parameters in the Windows registry.
Note.
Global variables are stored in the system registry to maintain their values after Windows restart. All global variables are
stored in the registry branch HKEY_USERS\S-1-5-21-…\Software\ITVScript\ITVSCRIPT and
HKEY_CURRENT_USER\Software\ITVScript\ ITVSCRIPT. To access a global variable directly from the registry, search the
registry for it by the same name.
Usage examples. To check the method operation in the following test example the value 1 sets to the "2" global variable and then
increases per 1 and displays on the script debug window.
if(Event.Action =="RUN")
{
Int_var(2) = 1;
Int_var("2")++;
DebugLogString(Int_var("2").toString());
}
Method arguments:
objtype - Required argument. The type of the object whose parent’s type should be returned. It takes the following values: Type
– String, range – existing object types.
The Main object is the highest level object in the hierarchy. It is the parent for all objects of the Computer, Screen, and other
types.
Usage examples
Problem. When Macro 1 starts, display in the debugger window the names of four object types of higher hierarchical order
starting from the detection zone.
Method arguments:
1. dst - Required argument. The name of the remote computer where the Intellect kernel is installed. The value of dst should
correspond to one of the names of the computers registered during setup of the video surveillance system. It takes the
following values: Type – String, meeting the requirements for network computer names; range – computer names
existing in the system.
2. src - Required argument. The name of the local computer where the script executes. The value of src should match the
name of the local computer as it is registered in Intellect. It takes the following values: Type – String; meeting the
requirements for network computer names.
The information about all connections of the local computer (kernel) to other remote computers (kernels) registered during the
setup of the distributed architecture, is displayed in the Architecture tab of the System Settings window.
Usage examples
Problem. Upon a camera alarm, determine the name of the server this camera is connected to, and output the IP-address of the
connection between this server and the local computer where the script executes, to the debugger window.
Method arguments:
1. objtype - Required argument. The type of the object whose name is to be returned. It takes the following values: Type –
String, range – existing object types.
2. id - Required argument. Identification number of the object of the type set in the objtype parameter. It takes the following
values: Type – String, range – existing object identification numbers of the specified type.
Usage examples
Problem. In case of alarm in any sensor, open the information window with the following text - "Alarm in the <alarmed sensor
name> sensor connected to the <server name which the sensor is connected to> server”.
Note
Create the information dialog window beforehand using the Arpedit.exe utility and save it as test.dlg in the
<Intellect>\Program folder.
Method arguments:
1. objtype - Required argument. The type of the object whose state is to be returned. It takes the following values: Type –
String, range – existing object types.
2. id - Required argument. Identification number of the object of the type set in the objtype argument. It takes the following
values: Type – String, range – existing identification numbers of the objects of the specified type.
Usage examples
Problem. When Relay 1 activates (for example, on pressing the button connected to Relay 1), arm Sensor 1. The next time Relay 1
activates, disarm Sensor 1.
Method arguments:
1. objtype - Required argument. The type of the object whose parameter’s value is to be returned. It takes the following
values: Type – String, range – existing object types.
2. id - Required argument. Identification number of the object of the type set in the objtype argument. It takes the following
values: Type – String, range – existing identification numbers of the objects of the specified type.
3. param - Required argument. The name of the parameter whose value is to be returned. It takes the following values:
Type – String, range – available parameters of the object.
Usage examples
See the example for the SetObjectParam method.
Method arguments:
1. objtype - Required argument. The type of the object whose parent’s identification number should be returned. It takes
the following values: Type – String, range – existing object types.
2. id - Required argument. Identification number of the object of the type set in the objtype argument. It takes the following
values: Type – String, range – existing identification numbers of the objects of the specified type.
3. parent - Required argument. The type of the object which is the parent of the object type specified by the objtype
argument. It takes the following values: Type – String, range – existing object types.
Usage examples
Problem. If a camera turns off or stops transmitting a video signal, send an e-mail message with the following subject: "Warning!
Camera turned off" and, in the message body, the number of the camera and of the server it is connected to.
Note
The Short Messages Service is supposed to be installed and working properly
Method arguments:
1. objtype - Required argument. The type of the object that the action should be generated for. It takes the following
values: Type – String, range – existing object types.
2. id - Required argument. Identification number of the object of the type set in the objtype argument. It takes the following
values: Type – String, range – existing identification numbers of the objects of the specified type.
3. action - Required argument. The action to be generated. It takes the following values: Type – String, range – available
actions for the objects of the specified type.
4. param<value> - Required argument. Several arguments of this type can be specified. The parameters of the action.
One parameter has the following syntax:
"param<value>", where
param – name of the parameter;
value – value of the parameter.
Several parameters have the following syntax:
"param1<value1>,param2<value2>…"
Elements of the list are separated by commas with no white space. If no parameters need to be specified, an empty string is used:
DoReactStr("CAM","1","REC","");
The param argument can take the following values: Type – String, range – available parameters of the specified action. The value
argument can take the following values: Type – String, range – depends on the parameter.
For all reactions it is possible to specify delay of reaction performing using delay<> parameter. Delay is specified in seconds.
Note
Two types of system messages are available in the Intellect system: events and actions.
The events usually contain some information and are used as notifications sent to all Intellect kernels connected to
each other during the system setup.
The actions are the control commands sent to specific objects. An action is transmitted only to the kernel where the
related object belongs, and not to the whole system.
The DoReactStr and DoReact methods are used to generate actions. The NotifyEventStr and NotifyEvent methods are
used to generate events.
Usage examples
Problem. When an alarm is received from a camera, switch Monitor 1 to single window mode and show the video from the
alarmed camera in this window.
Problem. When alarm by some camera is completed the record is to be continued for 5 second and after this time the record will
be stopped (analogue of Post-record mode).
Problem. Use macros 1 to enable telemetry control using mouse on the camera 4 displayed in the monitor 10. Use macros 2 to
disable it.
Method arguments:
msgevent - Required argument. The action sent to the specified object. It takes the following values: MsgObject objects created
earlier in the script.
Note
Two types of system messages are available in the Intellect system: events and actions.
The events usually contain some information and are used as notifications sent to all Intellect kernels connected to
each other during the system setup.
The actions are the control commands sent to specific objects. An action is transmitted only to the kernel where the
related object belongs, and not to the whole system.
The DoReactStr and DoReact methods are used to generate actions. The NotifyEventStr and NotifyEvent methods are
used to generate events.
Usage examples
Problem. When Relay 1 closes, close Relays 2 and 3. When Relay 1 opens, open Relay 2.
Method arguments
1. objtype - Required argument. The type of the object whose parameters are to be changed. It takes the following values:
Type – String, range – existing object types.
2. id - Required argument. Identification number of the object of the type set in the objtype argument. It takes the following
values: Type – String, range – existing identification numbers of the object of the specified type.
3. param<value> - Required argument. Several arguments of this type can be specified. The parameters of the action.
One parameter has the following syntax:
“param<value>”, where
param – name of the parameter;
value – value of the parameter.
Several parameters have the following syntax:
“param1<value1>,param2<value2>…”.
Elements of the list are separated by commas with no white space.
The param argument can take the following values: Type – String, range – available parameters of the specified action. The value
argument can take the following values: Type – String, range – depends on the parameter.
Usage examples
Problem. When Macro 1 starts, set the values of the following parameters of Cameras №1-4: PTZ device number (telemetry_id)
and synchronous microphone number (audio_id). The values should be equal to the camera numbers plus 1.
Method arguments:
1. objtype - required argument. The type of the object the parameters of which are to be changed. It takes the following
values: type – String, range – existing object types.
2. id - required argument. Identification number of the object of the type set in the objtype argument. It takes the following
values: type – String, range – existing identification numbers of the objects of the specified type.
3. param<value> - required argument. Several arguments of this type can be specified. The parameters of the action.
One parameter has the following syntax:
“param<value>”, where
param – name of the parameter;
value – value of the parameter.
Several parameters have the following syntax:
“param1<value1>,param2<value2>…”.
Elements of the list are separated by commas with no white space.
The param argument can take the following values: values of the String type, range is limited by available parameters of the
specified action. The “value” argument can take the following values: values of the String type, the range depends on the
parameter.
Example. When Macro 1 starts, temporary remove all cameras on the first monitor.
Method arguments:
msgevent - required argument. It sets a reaction transmitted to the required object. It takes the following values: MsgObject
objects created earlier in the script.
Example. When macro 2 starts, guard on Sensor 2. The command is to be transmitted to all system kernels as the reaction to be
registered in the Events Log.
Method arguments:
1. objtype - Required argument. The type of the object that the event should be generated for. It It takes the following
values: Type – String, range – existing object types.
2. id - Required argument. Identification number of the object of the type set in the objtype argument. It takes the following
values: Type – String, range – existing identification numbers of the object of the specified type.
3. event - Required argument. The event to be generated. It takes the following values: Type – String, range – available
events for the objects of the specified type.
4. param<value> - Required argument. Several arguments of this type can be specified. The parameters of the event.
One parameter has the following syntax:
"param<value>", where
param – name of the parameter;
value – value of the parameter.
Several parameters have the following syntax:
"param1<value1>,param2<value2>…".
Elements of the list are separated by commas with no white space. If no parameters need to be specified, an empty string is used:
DoReactStr("CAM","1","MD_START","");
The param argument can take the following values: Type – String, range – available parameters of the event. The value argument
can take the following values: Type – String, range – depends on the parameter.
Note
Two types of system messages are available in the Intellect system: events and actions.
The events usually contain some information and are used as notifications sent to all Intellect kernels connected to
each other during the system setup.
The actions are the control commands sent to specific objects. An action is transmitted only to the kernel where the
related object belongs, and not to the whole system.
The DoReactStr and DoReact methods are used to generate actions. The NotifyEventStr and NotifyEvent methods are
used to generate events.
Usage examples
Problem. When an alarm is received, send the “panic lock” event corresponding to the camera region. For camera identification
numbers from 1 to 4, use region 1; for camera numbers from 5 to 10, use region 2.
Method arguments:
msgevent - Required argument. The event sent to the system. It takes the following values: MsgObject objects created earlier in
the script.
Note
Two types of system messages are available in Intellect system: events and reactions.
The events usually contain some information and are used as notifications sent to all Intellect kernels connected to
each other during the system configuration.
The reactions are the control commands sent to specific objects.
The reactions are transmitted only to the kernel where the object belongs, and not to the whole system.
The DoReactStr and DoReact methods are used to generate reactions. The NotifyEventStr and NotifyEvent methods are
used to generate events.
Example. When the Backup Archive 1 module starts archiving video recordings, the analog output 1 of the Video Capture Device 2
is disabled. Send the command as an event to be registered in the Events Log.
Note
While executing this script, the analog output 1 of the Video Capture Device 2 is not disabled
if (Event.SourceType == "ARCH" && Event.SourceId == "1" && Event.Action == "ACTIVE ")
{
var msgevent = CreateMsg();
msgevent.SourceType = " GRABBER ";
msgevent.SourceId = "2";
msgevent.Action = "MUX1_OFF";
NotifyEvent(msgevent);
}
Method arguments:
msgevent - required argument. It sets the event transmitted to the system. It takes the following values: MsgObject objects
created earlier in the script.
Example. When Macro 1 starts, the first camera is set for recording. The command is to be transmitted to all system kernels as the
event to be registered in the Events Log.
Note
While executing this script, camera1 is not set for recording.
Note
To start this script create the Timer object with ID=1 beforehand. Set value=1 to the Second parameter of the Timer
object, leave other parameters without changing («Any by default)
Attention!
Attention! If the Lock method has been called, then the Unlock method has to be called too. Otherwise the system can
freeze.
function Lock()
function Unlock()
Example. When Macro 1 starts, calculate total alarmed relays and sensors. Objects of each type are to be calculated at the same
time (in an individual script). The result is to be stored to “counter” global variable.
Script 1:
Script 2:
Note
If the Lock() and Unlock() methods are not used in this example, then collisions may occur and calculated value will be
less than a real one
The method returns 0 if the current user has not been assigned access rights of type param for the object; it returns 1 if these
rights have been assigned.
Method arguments:
1. compname - required. Corresponds to the name of the Computer object on which the object was created in the hardware
tree.
2. objtype - required. Corresponds to the type of the system object to which access rights are are being checked. Allowed
values: String type; the set of values is restricted to the object types registered in the system.
3. id - required. Corresponds to the identification (registration) number of the object of the type specified by the objtype
argument. Allowed values: String type; the set of values is restricted to the identification numbers of objects of the
specified type, which are registered in the system.
4. param - required. Corresponds to the number of the type of rights which are being checked. A description of rights is
given in Limiting access to the administration of the system objects, control and viewing functions of the Administrator’s
Guide. Allowed values:
a. 0 - NoView access rights. The method will return 1 if there are no administrative, control-, or viewing rights for the
object (red 'x').
b. 1 - NoControl access rights. The method will return 1 if there are only viewing rights (letter M).
c. 2 - ViewAndControl access rights. The method will return 1 if there are control- and viewing rights for the object
(green box).
d. 3 - ViewOrControl access rights. The method will return 1 if there is either viewing or control rights for the object.
e. 4 - Not access rights (e.g. no access rights).
f. 5 - Configure access rights. The method will return 1 if there are administrative, control- and viewing rights for the
object (gray box).
For example: Based on a Computer object named "S-UYUTOVA", a Camera object with the identifier 1 has been created in the
hardware tree. To determine the current access rights to the object:
var i = 0;
for(i = 0; i <= 5; i++)
{
var result =
IsAvailableObject('S-UYUTOVA','CAM','1', i);
DebugLogString("right "+i+" = "+result);
}
Method arguments:
1. cmp - required. Specifies the name of the computer on which the Intellect Software System is installed. Allowed values:
values of String type that satisfy the requirements for computers' network names; the set of values is restricted to the
names of computers registered in the system.
For example: To display the identifier of the current user of the Intellect Software System, which has been installed on a
computer named 'WS3':
DebugLogString(GetUserId("WS3"));
Method arguments:
1. obj_type – required argument. Specifies type of system object description of which is required to get.
2. event – required argument. Specifies the name of object description of which is required to get.
Example. Display messages about receiving of events for camera 1 on the free language in the Debug window.
Method arguments:
1. obj_type – required argument. Specifies type of system object, ID of which is required to get.
2. obj_param - required argument. Specifies the name of parameter in database on value of which the object is to be found.
3. param_value – required argument. Specifies the required value of object parameter.
Example. Find cameras from which black-and-white image is receiving and set the Color parameter equals to 1 for them.
{
var id = GetObjectIdByParam("CAM","color","0"); //receiving the first object ID
while (id){ //while exist the Camera objects from which black-and-white image is receiving
SetObjectParam ("CAM", id, "color", "1"); //change the Color parameter for found object
id = GetObjectIdByParam("CAM","color","0"); //receiving the next object ID
}
}
Saving of frame is also can be performed using the GET_FRAME reaction of the CAM object. It is required to specify the path for
saving file with frame in the path parameter of this reaction. FRAME_SENT event is created in the system if the GET_FRAME
reaction has not got the path parameter. In the data parameter of the FRAME_SENT event the video image frame which is to be
saved using the SaveToFile method is stored.
The reaction allows exporting of video image frame even if the camera is not displaying in the Monitor window.
Method argument:
1. path – mandatory argument. Specifies the full path to save the file with frame.
2. data – mandatory argument. Specifies data to save in file.
3. param – mandatory argument. Defines necessity of conversion from base 64 format before saving. Possible parameter
values:
a. true – decode from base64 before saving;
b. false – save string without conversion.
Time of frame saving depends on the anchor frames frequency. The higher the anchor frames frequency, the less time.
Example. Save the frame receiving from Camera 1 in the test.jpg file on the D disk:
Method argument:
1. type1 – the type of object for which linked objects are to be returned.
2. id – identification number of object for which linked objects are to be returned.
3. type2 – the type of linked objects which are to be returned. If empty string is sent then linked objects of all types will be
returned.
Example.
The Objects connection object is configured the following way:
Display in debug window the list of objects linked with the camera 1.
if (Event.SourceType == "MACRO")
{
varmsgstr = GetLinkedObjects("CAM","1","MACRO")
As a result the "Linked objects MACRO:1" message will be displayed in the script debug window.
Method argument:
1. varName – required argument. Sets name of variable for saving in the file.
2. varValue – required argument. Sets value of t variable.
3. path – required argument. Sets full path to the ini-file in which variable is to be stored. Storage of variables can be
replaced on the network resource. Enter the network path in the argument for it.
Example. Write the MyVar variable to the \\fs\temp\test.ini file and specify the «Helloworld!” value to it. Then read the written
value and display it on the script debug window.
Method arguments:
1. id is a required argument. It specifies the timer ID. Allowed values are int or string type.
2. milliseconds is a required argument. It specifies the period with which the timer will trigger if it is not stopped by the
KillTimer method. It is specified in milliseconds. Allowed values are int type.
Example. 2 seconds after the macro 1 is executed, start recording on camera 1.
Method arguments:
1. id is a required argument. It specifies the timer ID. Allowed values are int or string type.
Example. See in the The SetTimer method section.
Method arguments:
1. parent - Required argument. The type of the object for which you want to find out child objects . It takes the following
values: Type – String, range – existing object types.
2. id - Required argument. Identification number of the object of the type set in the parentargument. It takes the following
values: Type – String, range – existing identification numbers of the objects of the specified type.
3. objtype - Required argument. The type of the child objects whose identification numbers should be returned. It takes the
following values: Type – String, range – existing object types.
Example. Arm all cameras on WS2 computer on Macro 1.
Method arguments:
1. data_in – required argument. Sets a path to the file to be encoded.
Example. At running Macro 1, encode 1.bmp to Base64 and save it to 2.bmp.
Method arguments:
1. data_in – required argument. Sets a string to be encoded.
Example. Dencode a Unicode string to Base64 then encode back and put to the debug log.
var test =
Base64Decode("MAAzAC0AMAA3AC0AMgAwADEAOQAgADEANQA6ADMAOQA6ADQAMAA6AA0ACgB0AGUAcwB0ACAAMQANAAoAM
AAzAC0AMAA3AC0AMgAwADEAOQAgADEANQA6ADQAMgA6ADIAMQA6AA0ACgB0AGUAcwB0ACAAMgA=",true);
DebugLogString("----->"+test);
var res = Base64EncodeW(test);
DebugLogString("----->"+res);
If the Base64Decode method received the "true" parameter, the script will have the following output:
03-07-2019 15:39:40:
test 1
03-07-2019 15:42:21:
test 2
1.2.2 The MsgObject and Event objects and their built-in methods and properties
Note
Symbol "*" corresponds to identification number of a camera in the system (from 1 to 4)
//Switching the cameras to the Nigh mode by arming the *.2 detection zones
if(Event.GetSourceId() == "2")
{
for (k = 1; k<= 4; k = k+1)
{
DoReactStr("CAM_ZONE", k + ".1", "DISARM", "");
DoReactStr("CAM_ZONE", k + ".2", "ARM", "");
DoReactStr("CAM_ZONE", k + ".3", "DISARM", "");
}
}
//Switching the cameras to the Rain mode by arming the *.3 detection zones
if(Event.GetSourceId() == "3")
{
for (k = 1; k<= 4; k = k+1)
{
DoReactStr("CAM_ZONE", k + ".1", "DISARM", "");
DoReactStr("CAM_ZONE", k + ".2", "DISARM", "");
DoReactStr("CAM_ZONE", k + ".3", "ARM", "");
}
}
}
Method arguments:
param - required argument. The name of the parameter of the object created using MsgObject (or of the Event object). It takes
the following values: type – String, range – available parameters for the objects of the specified type.
Note
If the object has no parameter with this name, then the method restores an empty string
Example. When any event from any camera is registered, check from which computer the event comes. If the computer has
“WS3” name, create the event copy where the computer’s name is “Computer”.
Method arguments:
1. param - Required argument. The name of the parameter of the object created using MsgObject (or of the Event object). It
takes the following values: Type – String, range – available parameters for the objects of the specified type.
2. value - Required argument. The value to be assigned to the parameter specified in the param argument. It takes the
following values: Type – String, range – depends on the parameter.
Usage examples
See the example for the GetParam method.
Note
The Short Messages Service is supposed to be installed and working properly.
param1<value1>,param2<value2> - list of parameters and their values. Elements of the list are separated by commas with no
white space. If no parameters need to be specified, an empty string is used after the vertical line (|), for example:
"CAM|1|MD_START|"
Usage examples
Problem. Upon an alarm in Sensor 1 or 3, start recording audio from Microphone 1. Upon an alarm in Sensor 2 or 4, start
recording audio from Microphone 2.
StringToParams(String params)
Method arguments:
params - Required argument. A String type variable to be transformed into a list of parameters for the MsgObject object. It takes
the following values: String variables matching the syntax for MsgObject parameter list representation:
“param1<value1>,param2<value2>…”, where
param1<value1>,param2<value2> - list of parameters and their values. Elements of the list are separated by commas with no
white space. If no parameters need to be specified, an empty string is used after the vertical line (|), for example:
“CAM|1|MD_START|”
Usage examples
Example. Upon registration the connection (“Attach”) event for any camera, in the system retrigger the “Attach” event with
modified Number of the PTZ device (telemetry_id) and Number of the microphone for synchronous recoeding (audio_id)
parameters. The values should be equal to the corresponding camera numbers plus 1.
Clone() : MsgObject
}
if(Event.Action == "OFF")
{
msgevent.SourceId = "2";
DoReact(msgevent);
DoReactStr("CAM","2","REC","");
DoReactStr("GRELE","2","OFF","");
}
}
A line is replied :
CAM||COUNT|id.3<5>,id.count<4>,id.0<2>,id.1<3>,id.2<4>
where id.count<> – number of ID objects,
id.[count]<> – ID object.
Method’s arguments:
objectType –required argument. Set the type of the system object, for which the value of the given parameter should be given
back ("CAM","GRAY","GRABBER" e.t.c.).Accepted values: type String, range is restricted by object types registered in the system.
Example. All the cameras should be armed upon the start of Macros№1.
Method arguments:
1. objectType – required argument. Set the type of the system object ("CAM", "GRAY", "GRABBER" e.t.c.), for which the type
of a parent object should be given back. Accepted values: type String, range is restricted by object types registered in the
system.
2. objectId – object’s identifier. Accepted values: String type.
Example. It is necessary to check the color control of camera №2 upon the start of Macros№1. If camera 2 is a color one, set it to
recording.
SourceType : String
Usage examples
Problem. When Relay 1 closes (for example, the button connected to the relay is pressed), print the frames from Cameras 1 and 2.
SourceId : String
Usage examples
See the example for the SourceType property.
SourceId : String
Usage examples
See the example for the SourceType property.
Attention!
Creating of large number of the Script objects (more than 100) can result to instable system working.
The settings panel allows choosing the time zone and the computers (kernels) for executing the script.
Note.
To set all checkboxes checked select one in the column and click Ctrl+A. To set all checkboxes unchecked select one and
click Shift+A.
It also has the button for starting the Editor-Debugger tool and the text window for viewing the script text created by means of
this tool. The scripts can be edited in the Editor-Debugger tool or directly in the settings panel for the Script object.
Moreover, one can configure the filter of events – the list of events which are to be processed by the Script system object. In
general, including the event to the filter equals to if operator in the text of script, i.e. when the event is in the table, the operator
can be omitted.
Attention!
The event filter is to be set when creating a script in large distributed configurations. Otherwise the module will process
all incoming events and it will lead to module malfunctioning.
Example
If the Object’s type column has the Macro value, the Identifier column has the 1 value and the Event column has the
Executed value, then
The detailed information on the elements of the settings panel for the Script object is given in Administrator's guide.
Example.
Recording on Camera 1 is to be started when controlling PTZ device in the Video surveillance monitor.
For this adjust the Script object as follows:
1. Select the required time zone when the script is to be executed.
2. Enter the script text:
The filter can be set by the UPDATE_OBJECT event of the CORE object. Example command to add Camera 1 object to the Script 2
filter:
NotifyEventStr("CORE","","UPDATE_OBJECT","objtype<SCRIPT>,objid<2>,EVENT.objid.
0<1>,EVENT.objid.1<10>,EVENT.action.count<2>,flags<>,EVENT.action.0<>,EVENT.action.
1<>,EVENT.objtype.0<CAM>,EVENT.objtype.count<2>,EVENT.objtype.
1<CAM>,EVENT.objid.count<2>");
The Editor-Debugger utility contains the built-in text editor and the debugger window.
To help with writing correct codes, the text editor automatically highlights objects, methods and properties in different colors.
Note.
The position of the cursor in each script is stored in the context of one Intellect session (the cursor position is
reset at the product restart). For example, if you place the cursor at the end of //Line 2 in Script 1, then switch to
Script 2 and perform any action in it, the cursor will be still at the end of //Line 2 when you return to Script 1.
The debugger window allows viewing the information about all events registered by the system. You may filter the events to be
shown in the debugger window. A separate debugger window is created for each Script object, which allows each script to be
debugged individually using the filters.
To debug the script, it is possible to test run using a user-defined test event generated by the utility and not registered in the
system. To display or edit this event, select Debug and edit -> Summary Information, and then go to the Trial event tab on the
panel that opens at the bottom of the window. For details, see Creating and using test events.
Scripts can be saved as Script objects or as text files on the hard drive.
Note.
The Debug window can be enabled without the tweaki.exe utility. For this set values 1, 2 or 3 for the Debug string
parameter in the HKEY_LOCAL_MACHINE\SOFTWARE\ITV\Intellect section of the Windows registry
(HKEY_LOCAL_MACHINE \Software\Wow6432Node\ITV\Intellect for 64-bit system).
3. Select Intellect section in the tree on the left side of the utility dialog box.
4. Change the value of the Debug mode parameter from Disabled to Debug 1, Debug 2 or Debug 3.
5. Click the OK button.
6. Start Intellect.
7. A new Debug window item appears on the Main control panel of Intellect.
Note.
This menu is also available in the Windows notification area (system tray) – left click on the button or short
click the F8 hot key.
8. Select the Debug window item on the Main control panel in order to display the Debug window on the monitor. The
selected Debug window item is marked with a flag.
To hide the Debug window, re-select the Debug window item on the Main control panel.
Note.
To disable the Debug window, select the Disable value for the Debug mode in the tweaki.exe utility or set value 0 for
the Debug string parameter in the HKEY_LOCAL_MACHINE\SOFTWARE\ITV\Intellect section of the Windows registry
(HKEY_LOCAL_MACHINE \Software\Wow6432Node\ITV\Intellect for 64-bit system). These actions are performed when
Intellect is exited.
Note.
Use the context menu for operations with text in the Info window (right-click on the highlighted text).
2. In the Highlight in window specify the line that is to be highlighted every time it appears in the message (1).
Note.
To add a line to the table, click the ↓ key on the keyboard.
2. In the Filter window specify the lines that are to be in the message for it to be displayed in the Debug window (1).
3. Specify the lines that are to be in the message for it to not be displayed in the Debug window (2).
Note.
To add a line to the table, click the ↓ key on the keyboard.
As a result only messages that fit the search criteria are displayed in the Debug window.
The event and reaction filter is now configured.
Note.
To close the Search window click the Cancel button.
1.3.4 Getting the list of object names, reactions and events in INTELLECT™
The list of object names, reactions and events used while programming in INTELLECT™ software can be got with the help of
ddi.exe tool.
ddi.exe tool is started in one of the following ways:
1. “Start → All Programs → Intellect → Tools → System configuration.
Note
ddi.exe tool is available in the Start menu with the following types of Intellect installation: Server,
Administrator’s workplace and Workplace for monitoring
3. In the DDI tab, select the object which events and reactions are to be viewed (2).
4. To view the name of the selected object, go to the Names tab (3).
5. To view the list of events for the selected object, go to the Events tab.
6. To view the list of reactions for the selected object, go to the Reactions tab.
The detailed information on working with ddi.exe tool is given in Administrator's guide.
Note.
If the Sensor is armed, then at the Sensor switching on/off the "Alarm" event appears depending on the alarm mode
setting (see the Creating and configuring the Sensor system object section of the Installing and configuring security
system components guide). If the Sensor is disarmed, the "Closed" / "Opened" events appear correspondingly.
Note
By default, the Never time zone is selected
3. In the Computers field, select the computers (kernels) where the script should run.
Note
By default, the script will run on all computers. The list shows only the computers registered in the Hardware tab
of the System Settings window
4. Click the Editor-Debugger button in the bottom of the Script settings panel to open the Editor-Debugger utility.
Note
Use the Editor-Debugger utility to create, edit and save scripts in JScript. The text of saved script available to be
edited is saved on the setting panel of the Script object.
5. In the Editor-Debugger utility window, open the Script Debug/Edit list and select the Script object to be edited (for
example, Script 2).
6. Enter the text of the script in JScript programming language into the Script field.
Note.
For convenience, the cursor position is stored when script is saved or when switching between scripts in Editor-
Debugger during a session, i.e. until Intellect is restarted.
7. Run the script using a test event. To create a test event, select the Edit test event in the Debug and edit menu. The Test
message window will open allowing to set the test event parameters.
8. To run the script using the test event, select Test run in the Debug and Edit menu.
Note.
Also, use Ctrl+T hotkey to test-run the script by test event.
9. Check the script syntax using the interpreter which is built-in into the Editor-Debugger utility. The verification results
showing the error and its location will be displayed in the debugger window of this script in the Script messages list.
Correct the script to eliminate the error and repeat the verification.
Note
See the detailed information about using test events for script debugging in the Script Debugging section
10. After debugging the script using the Editor-Debugger utility, run it with a real event. Check the result. If the result is
incorrect, change it and run again.
Script creation is considered complete if it runs correctly.
Note.
Also, use Ctrl+S hotkey to save the script in the database.
Note
The script is automatically saved in the corresponding Script object upon closing the Editor-Debugger utility
To save the script in the file, in the File menu, select Save on disk. To open a script saved in a file in the Editor-Debugger utility,
in the File menu, select Open from disk.
Note.
The search runs down from the current cursor position.
1. Before replacement:
2. After replacement:
6. In the Editor-Debugger window, open the Script Debug/Edit list and select the Script 2 object.
figure.
10. To run the script with the test event, select Test run in the Debug and edit menu.
11. Open the Script Messages list and select Script 1. The debugger window will open at the right side.
12. 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.
13. Change the text of the script (see the “var i;” line).
14. In the File menu, select Save to database to save the script.
15. Repeat steps 10 and 11.
16. 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.
21. Check the accuracy of the script result. The Hot recording field in the Camera 1 to Camera 4 object settings panels
should read “10”.
Note
The Hot recording field in the Camera settings panel is empty by default
1. In the Debug and edit menu, select Edit test event, or click the button in the toolbar.
2. The Test message window will open.
1.6.3.1 Displaying messages about starting, verifying, changing and executing scripts in the
debugger windows
The messages in the debugger window track the stages of starting, verification and execution of scripts.
When the event occurs that triggers the script, the following message is displayed in the debugger window: “Process Event:
<script triggering event>”; for example, if the script starts upon Macro 1 execution, the line reads “Process Event:MACRO|1|RUN|”.
At the moment of changing the script in Debugger utility or in the Intellect, the debugger window displays the message «Process
Event: SCRIPT|script’s number|SETUP|» (for example, while changing the script with number 1, the debugger window displays
«Process Event: SCRIPT|1|SETUP|»).
Script syntax is checked before execution. In case of syntax errors, related error messages will be displayed in the debugger
window. Figure shows an example of a syntax error message.
Right-click the message to view its complete text. The Information window will open containing the full text of the error
message.
In addition, the information on the last script run is displayed on the Script messages tab at the bottom of the Editor-
Debugger utility window. If this panel is not displayed, select Debug and edit -> Summary Information, or click the button
on the toolbar.
Note
We do not recommend using third-party debuggers, since they do not provide full compatibility with the Intellect
software, and may lead to failure of the Intellect software
We strongly recommend introducing the breakpoint in the script when using third-party debuggers. To insert the breakpoint, add
the following line to the script: “debugger;”. The script execution will pause at this line, and the debugger will start.
When a third-party debugger is used, scripts can be started with test events only.
To start the script using a third-party debugger, do the following:
1. Create the script and insert the “debugger;” line in it.
2. Create a test event for the script.
3. In the Debug and edit menu, select Test run in third-party debugger.
4. The Just-In-Time Debugging window will open. Select one of the debuggers installed on the computer.
if (Event.SourceType== "MACRO" && Event.SourceId=="1" && Event.Action == "RUN"); //start Macro
1
{
debugger; // breakpoint
DebugLogString ("Hello world");
}
On the page:
• Example 1. Visualisation of
operating the Queue length
detection in the Video
Surveillance monitor
• Example 2. Visualisation of
operating the People Counter
detection in the Video
Surveillance monitor
• Example 3. Setting the text for
displaying on the map
• Example 4. Displaying camera
on the monitor by clicking the
button on the remote control
• Example 5. Sending command
to camera using the camera
HTTPAPI
• Example 6. Script for framing
abandoned objects in live video
• Example 7. Using START and
STOP events for Failover
• Example 8. Using the embedded
visitors counter on Bosch
FLEXIDOME IP dynamic 7000 VR
IP camera
• Example 9. Sending e-mail with
HTML markup
To illustrate available fields of application of scripts in Jscript see the following examples which can be used to create additional
functions in the system on the basis of the Script object.
1.7.1 Example 1. Visualisation of operating the Queue length detection in the Video
Surveillance monitor
The Queue length detection object (is part of the Detector Pack package), Camera and Captioner objects (instead of N, M, L
symbols set the corresponding numbers of the Queue length detection, Camera and Captioner objects) are to be created and
configured for correct script working in the Intellect software.
As a result the text message about the current queue length will be imposed on the video image while displaying the
corresponding camera in the Video Surveillance monitor.
Settings of the font, color and position of text is configured on the settings panel of the Captioner object.
Note.
When page<BEGIN> and page<END> parameters are in use, the corresponding fields of the subtitles database are filled
in – this enables data search using the Search by titles interface object.
1.7.2 Example 2. Visualisation of operating the People Counter detection in the Video
Surveillance monitor
The People Counter Detection object (is part of the Detector Pack package), Camera, Captioner and Macro objects (instead of
N, M, L, P symbols set the corresponding numbers of the People counter detection, Camera, Captioner and Macro objects) are to
be created and configured for correct script working in the Intellect software.
As a result the text message about number of entering and exiting people will be imposed on the video image while displaying
the corresponding camera in the Video Surveillance monitor.
Note.
When page<BEGIN> and page<END> parameters are in use, the corresponding fields of the subtitles database are filled
in – this enables data search using the Search by titles interface object.
Settings of the font, color and position of text is configured on the settings panel of the Captioner object (see the Configuring
captions display on a video image section of the Administrator’s Guide document).
Previously create the Macro object on the Programming tab to null the counter of visitors. The name of the object can be
changed to “Null of people counter” for ease of using.
Macro of setting to zero can be run manually by main menu of the Intellect software package or automatically in any specified
time (use the Events table on the settings panel of the Macro object where the previously configured Time zone object is to be
specified). Detailed information about using the Macro and Time zone objects is given in the Administrator's Guide document).
1.7.4 Example 4. Displaying camera on the monitor by clicking the button on the remote
control
The following example is valid only for cameras in configuration of which there is PTZ control panel. When configuring Video
surveillance monitor select the Go to preset action with 1,2,3...,0 parameters for ten joystick buttons (see Assigning commands
to joystick buttons using the Monitor section of Installing and configuring security system components guide).
Example. When the button is clicked on the control panel, display corresponding camera in the active monitor. The script is to
timer trigger with ID=1.
Note.
The Timer object is to be created and configured beforehand and the current year is to be set. Information on how to
configure the Timer object can be found in Creating and configuring the Timer object section of Administrator's Guide
After each button click on the control panel wait for 2 seconds until clicking another button. If there is no button click, then the
camera with dialed number is to be displayed.
function DoPreset(preset)
{
xmlhttp=new ActiveXObject("MSXML2.XMLHTTP");
if(xmlhttp == null)
{
return;
}
xmlhttp.open("GET", "http://192.168.0.13/httpapi/SendPTZ?
action=sendptz&PTZ_PRESETSET="+preset, false,"admin","1234");
xmlhttp.send();
DebugLogString(xmlhttp.status);
}
if (Event.SourceType == "MACRO" && Event.SourceId == "6" && Event.Action == "RUN")
{
DoPreset("85");
}
if (Event.SourceType=="CAM_VMDA_DETECTOR")
{
cam=GetObjectParentId("CAM_VMDA_DETECTOR",Event.SourceId,"CAM");
if (Event.Action=="ALARM")
{
var x1,x2,y1,y2;
x1=Event.GetParam("x");
x2=Event.GetParam("w");
y1=Event.GetParam("y");
y2=Event.GetParam("h");
x2=parseInt(x1)+parseInt(x2);
y2=parseInt(y1)+parseInt(y2);
DoReactStr("MONITOR","","SET_MARKRECT","cam<"+cam+">,color<255>,id<"+cam+">,x1<"+x1+">,x2<"+x2+"
>,y1<"+y1+">,y2<"+y2+">");
DebugLogString("x1:"+x1+" x2:"+x2+" y1:"+y1+" y2:"+y2);
}
else
{
DoReactStr("MONITOR","","DEL_MARKRECT","cam<"+cam+">,id<"+cam+">");
}
}
if (Event.SourceType == "FAILOVER" )
{
if (Event.Action == "START") {action="DISABLE";}
if (Event.Action == "STOP") {action="ENABLE";}
id=Event.SourceId;
msg=CreateMsg();
msg.StringToMsg(GetObjectIds("FAILOVER"));
var
objCount=msg.GetParam("id.count");
for (i=0;i<objCount;i++)
{
pid=msg.GetParam("id."+i);
if (!(id==pid)) {
DoReactStr("FAILOVER",pid,action,"");
}
}
}
1.7.8 Example 8. Using the embedded visitors counter on Bosch FLEXIDOME IP dynamic 7000
VR IP camera
Upon reaching the number of visitors equal to 20 on the embedded visitors counter of the Bosch FLEXIDOME IP dynamic 7000 VR
IP camera (with ID 1), call the macro 1.
n=20;
if(Event.SourceType == "CAM_IP_DETECTOR" && Event.SourceId=="1" && Event.Action == "DETECTED")
{
v=Event.GetParam("param0").split(";")[1];
if (parseInt(v.split(":")[1])==n)
{
DoReactStr("MACRO","1","RUN","");
}
}
Table shows the description of the elements in the Script Debug/Edit panel.
1 Script Text field The text Latin, Cyrillic and Empty Unlimited number
of the script special symbols of characters
2 Event Text field Event description Latin, Cyrillic and Empty Unlimited number
in the line format special symbols of characters
Table shows the description of the elements in the Script Messages panel.
1 Description Auto Information about Latin, Unspecifi By default 200 lines are displayed in the list. The value can be changed
the events Cyrillic and ed using the DebugMaxLines registry key (see Registry keys reference
guide).
occurring in the special
system symbols
On the page:
2 Status bar Checkbox Shows or hides Boolean Checked Check – show status bar
the status bar Uncheck – hide status bar
1 Test run Item Runs the script with the test event - - -
debugger
3 Edit test event Item Opens the window for editing test events - - -
4 Set filter Item Opens the window allowing to set the filtering - - -
criteria for the messages in the debugger window.
1 Include Text field Only the lines containing the Latin, Cyrillic and Empty Unlimited number
words from this field will be special symbols of characters
displayed in the debugger window
2 Exclude Text field The lines containing the words from Latin, Cyrillic and Empty Unlimited number
this field will not be displayed special symbols of characters
in the debugger window
1 Words Text field Contains the words or any sequences Latin, Cyrillic Empty Unlimited number
of characters, that make the line and special symbols of characters
containing one of them, highlighted.
2 Color Drop-down The color for highlighting the lines RGB format Grey RGB colors
list
Table shows the elements of the toolbar in the script editing mode.
1 Test run Button Runs the script with the test event - - -
2 Test run in third-party Button Runs the script using the third-party debugger - - -
debugger
4 Edit test event Button Opens the window for editing test events - - -
5 Summary information Button Opens the Thread Information window that displays - - -
system, test and user messages related
to the current script
2 Colors Button Opens the window allowing to specify the words that - - -
a line should contain to be highlighted in color
4 Set filter Button Opens the window allowing to set the filtering criteria - - -
for the messages in the debugger window.
4 Appendix 2. Creating virtual objects with ability to set events, reactions and
states
Important!
Object (table) names should look like OBJ_<object type>.
Appendix 2. Creating virtual objects with ability to set events, reactions and states – 88
Programming Guide (JScript)
Note.
Id, name, parent_id, flags and guid parameters are mandatory for all objects. Custom_param1 and
custom_param2 are user parameters.
4. Save changes using the Save command in the File menu. The saved file must have dbi extension and must be located in
Intellect installation directory - C:\Program Files (x86)\Intellect\intellect.custom.dbi
dbi file preparation is complete.
Appendix 2. Creating virtual objects with ability to set events, reactions and states – 89
Programming Guide (JScript)
3. Go to the Events tab and configure events that are to be supported by the object (see the figure).
4. Go to the Reactions tab and configure reactions that are to be supported by the object (see the figure).
Note.
Reactions of virtual objects are automatically converted into events. In other words, a virtual object
automatically generates an event when there is a reaction.
Appendix 2. Creating virtual objects with ability to set events, reactions and states – 90
Programming Guide (JScript)
5. Go to the States tab and describe the states that the object can take. Here there are two states – ON and OFF.
Note.
The postfix of file name is specified in the Image column – the image that is stored in < Intellect installation
directory>\Bmp. For instance, these will be custom_off.bmp and custom_on.bmp files (corresponding to ON and
OFF states) for CUSTOM object. These files will be used by the map module.
6. Go to the Transition rules tab and set the object state change logic.
Transition rules is a simple state machine – an event is an input action and a state is a result.
An unconditional transition is used in this case: if CUSTOM||ON event is received, then there is transition to the ON state, if
CUSTOM||OFF event is received, then there is transition to the OFF state.
7. To save changes use the Save command in the File menu. The saved file must have the ddi extension and be stored in the
folder corresponding to the required language, e.g. C:\Program Files (x86)\Intellect\Languages\en\intellect.custom.ddi
The ddi file preparation is completed.
Appendix 2. Creating virtual objects with ability to set events, reactions and states – 91
Programming Guide (JScript)
An XML file for a virtual object is created as follows:
1. Specify the name of object type in the object_type field (1).
Appendix 2. Creating virtual objects with ability to set events, reactions and states – 92
Programming Guide (JScript)
On the page:
When dbi, ddi and XML files are ready objects of a new type along with standard objects can be created in Intellect hardware tree.
User parameters are displayed on the settings panel of the created virtual object – custom_param1 and custom_param2 in this
example. Their values can be set in the table.
Appendix 2. Creating virtual objects with ability to set events, reactions and states – 93
Programming Guide (JScript)
Note.
Reactions of virtual objects are automatically converted into events. Thus, in the sample when ON reaction is executed
the object state changes thanks to set state transition rules (see ddi file preparation) and the icon corresponding to the
state will be shown on the map.
Appendix 2. Creating virtual objects with ability to set events, reactions and states – 94
Programming Guide (JScript)
Appendix 2. Creating virtual objects with ability to set events, reactions and states – 95