Go to documentation repository
Page History
| Section | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Below one can find some examples of scripts.
Example 1.
Display active camera on the analogue monitor.
...
| Code Block |
|---|
OnEvent ("MONITOR","1","ACTIVATE_CAM")
{
DoReact("CAM",cam,"MUX1");
} |
Example 2.
Start and stop PTZ patrolling using macros.
...
| Code Block |
|---|
OnEvent("MACRO","1","RUN")
{
DoReact("TELEMETRY","1.1","PATROL_PLAY","tel_prior<1>");
}
OnEvent("MACRO","2","RUN")
{
DoReact("TELEMETRY","1.1","STOP","tel_prior<1>");
} |
Example 3.
Display an alarm camera in the single monitor mode.
...
| Code Block |
|---|
OnEvent ("CAM",N,"MD_START")
{
DoReact("MONITOR","1","ACTIVATE_CAM","cam<"+N+">");
DoReact("MONITOR","1","KEY_PRESSED","key<SCREEN.1>");
} |
...
Example 4.
Here is an example of an infinite loop and how to stop it. Macro1 starts the loop and macro2 ends it.
...
| Code Block |
|---|
OnEvent("MACRO","1","RUN") //macro1 is run
{
//square brackets are needed to isolate wait statement to individual stream
[
flag=1;
for(a=1;flag<2;a=1) //cycle statement
{
Sleep(500); //wait statement creates pause of 500 milliseconds
ff="!!!!!!!!!!!!!!!!!!";
}
]
}
OnEvent("MACRO","2","RUN") // macro2 is run
{
flag=2;
} |
Example 5.
An alarm monitor the video from the alarm camera is always on.
...
| Code Block |
|---|
OnInit()
{
counter=0;
}
OnEvent("CAM",T,"MD_START")
{
if(strequal(counter,"0"))
{
DoReact("MONITOR","2","REMOVE_ALL");
DoReact("MONITOR","2","ADD_SHOW","cam<"+T+">");
}
counter=str(counter+1);
}
OnEvent("CAM",M,"MD_STOP")
{
counter=str(counter-1);
if(strequal(counter,"0"))
{
DoReact("MONITOR","2","ADD_SHOW","cam<"+M+">");
}
} |
Example 6.
An audio file is to be played back starting from the moment when one event appears until the moment of another event appearance. (Macro is run in this case).
...
| Code Block |
|---|
OnEvent("MACRO","1","RUN")
{
flag=1;
[
for(i=1;flag;i=1)
{
DoReact("PLAYER","1","PLAY_WAV","file<C:\Program Files\Intellect\Wav\cam_alarm_1.wav>");
Wait(3);
}
]
}
OnEvent("MACRO","8","RUN")
{
flag=0;
} |
...
Example 7.
There are 2 cameras with PTZ devices. Every 15 minutes a camera is to rotate to the position of preset 1 and a snapshot is to be made. Current time is the name for a file.
...
| Code Block |
|---|
OnTime(W,D,X,Y,H,M, "01")
{
if(strequal(M,"0"))
{
name=H+"_"+M+"_"+S+".jpg";
//Camera 1 PTZ device 1.1
name1="Camera1"+name;
DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
//Camera 2 PTZ device 1.2
name="Camera2"+name;
DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
}
if(strequal(M,"15"))
{
name=H+"_"+M+"_"+S+".jpg";
//Camera 1 PTZ device 1.1
name1="Camera1"+name;
DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
//Camera 2 PTZ device 1.2
name="Camera2"+name;
DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
}
if(strequal(M,"30"))
{
name=H+"_"+M+"_"+S+".jpg";
//Camera 1 PTZ device 1.1
name1="Camera1"+name;
DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
//Camera 2 PTZ device 1.2
name="Camera2"+name;
DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
}
if(strequal(M,"45"))
{
name=H+"_"+M+"_"+S+".jpg";
//Camera 1 PTZ device 1.1
name1="Camera1"+name;
DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1);
//Camera 2 PTZ device 1.2
name="Camera2"+name;
DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>");
DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name);
}
} |
...
Example 8.
Audio from microphone (OLXA_LINE) is not recorded simultaneously with a camera. By default the microphone is not armed. Audio is to be recorded when being activated by sound and being detected by the camera.
...
| Code Block |
|---|
OnInit()
{
flag=0;
}
OnEvent("CAM","3","MD_START")
{
flag=str(flag+1);
DoReact("OLXA_LINE","1","RECORD_START");
}
OnEvent("OLXA_LINE","1","ACCU_START")
{
flag=str(flag+1);
DoReact("OLXA_LINE","1","RECORD_START");
}
OnEvent("OLXA_LINE","1","ACCU_STOP")
{
flag=str(flag-1);
if (!(flag))
{
DoReact("OLXA_LINE","1","RECORD_STOP");
}
}
OnEvent("CAM","3","MD_STOP")
{
flag=str(flag-1);
if (!(flag))
{
DoReact("OLXA_LINE","1","RECORD_STOP");
}
} |
Example 9.
There are some cameras (num). Operation of motion detection on all cameras is to be checked (can also be used to check security sensors).
...
| Code Block |
|---|
OnInit()
{
run=0;
}
OnEvent("MACRO","1","RUN")
{
run=1; flag=""; num=8;
for(i=1;i<str(num+1);i=str(i+1))
{
DoReact("CAM",i,"DISARM");
DoReact("CAM",i,"REC_STOP");
DoReact("CAM",i,"ARM");
flag=flag+"N";
if(i<num)
{
flag=flag+"|";}
}
}
OnEvent("CAM",N,"MD_START")
{
if(run)
{
nn=str((N*2)-1);
flag=strleft(flag,str(nn-1))+"Y"+strright(flag,str(((num*2)-1)-nn));
}
}
OnEvent("MACRO","2","RUN")
{
run=0; fin=0;
for(i=1;i<str(num+1);i=str(i+1))
{
tmp=extract_substr(flag,"|",str(i-1));
if(strequal(tmp,"Y"))
{
fin=str(fin+1);
}
DoReact("CAM",i,"DISARM");
}
tmp="Total:"+str(num)+"Triggered:"+str(fin);
rez=MessageBox("",tmp,0);
} |
Example 10.
Patrol several zones using PTZ device presets; motion detection is to be enabled in some area of these zones.
...
| Code Block |
|---|
OnEvent("MACRO","1","RUN")
{
flag=1;
n=5;
[
for(i=1;flag;i=str(i+1))
{
DoReact("TELEMETRY","1.1","GO_PRESET","preset<"+i+">,tel_prior<3>");
Sleep(200);
DoReact("CAM_ZONE","1"+i,"ARM");
Wait(5);
DoReact("CAM_ZONE","1"+i,"DISARM");
if(strequal(i,n)) {i=0;}
}
]
}
OnEvent("MACRO","2","RUN")
{
flag=0;
} |
Example 11.
There are 2 displays – the first displays a virtual monitor with cameras, the second displays the Map object with Bolid sensors. When alarm is triggered by the camera - Display 1 is shown, when alarm is triggered by the sensor - Display 2 is shown, but on the CLIENT only.
...
| Code Block |
|---|
OnEvent("CAM",N,"MD_START")
{
DoReact("DISPLAY","2","DEACTIVATE","macro_slave_id<CLIENT>");
DoReact("DISPLAY","1","ACTIVATE","macro_slave_id<CLIENT >");
}
OnEvent("BOLID_ZONE",M,"ALARM")
{
DoReact("DISPLAY","1","DEACTIVATE","macro_slave_id<CLIENT >");
DoReact("DISPLAY","2","ACTIVATE","macro_slave_id<CLIENT >");
} |
...
Example 12.
When an alarm event appears on camera 1, add subtitles to video from this camera. When the alarm event ends, add subtitles about the alarm end.
Implementation:
| Code Block |
|---|
OnEvent("CAM","1","MD_START")
{
DoReact("CAM","1","CLEAR_SUBTITLES","title_id<1>"); //clear all subtitles from the video
DoReact("CAM","1","ADD_SUBTITLES","command<Camera 1 Alarm " + time + "\r>,page<BEGIN>,title_id<1>"); //time parameter adds the time of event registering to subtitles
}
OnEvent("CAM","1","MD_STOP")
{
DoReact("CAM","1","ADD_SUBTITLES","command<Camera 1 Alarm end " + time + "\r>,page<END>,title_id<1>");
} |
...