if (Event.SourceType=="TELEMETRY_EXT" && Event.Action=="KEY_PRESSED") { if (Event.GetParam("guid_pk")!="") { var key=Event.GetParam("param0"); key=parseInt(key); var type=Event.GetParam("device"); //0-8312 1-8313 type=parseInt(type); DebugLogString("Device:"+type+" Key:"+key); if (key<10 && type==0) { if (Var_var("arch")==1) { var WshShell = new ActiveXObject("WScript.Shell"); WshShell.SendKeys(key); } else Var_var("cam")+=key; } if (type==1) { switch(key) { case 1: DoReactStr("MONITOR",Itv_var("mon"),"EXPORT_FRAME","cam<"+Itv_var("cam")+">"); break; case 2: DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); Var_var("play")=0; break; case 3: DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); break; case 4: if (Var_var("play")==1) { Var_var("play")=0; DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); } else { Var_var("play")=1; DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); } break; case 5: DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); break; case 6: //DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); var WshShell = new ActiveXObject("WScript.Shell"); WshShell.SendKeys("^E") break; } } switch(key) { case 10: //Tab - àðõèâ\æèâîå âèäåî if (Var_var("arch")==1) { Var_var("arch")=0; DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); DebugLogString("### æèâîå âèäåî"); } else { Var_var("arch")=1; DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); DebugLogString("### ðåæèì àðõèâà"); } break; case 11: //Alt - Ýìóëÿöèÿ êëàâèøè Enter var WshShell = new ActiveXObject("WScript.Shell"); WshShell.SendKeys("{ENTER}") break; case 12: //Mon - set monitor id Itv_var("mon")=Var_var("cam"); Var_var("cam")=""; break; case 13: //Eneter - set camera id Itv_var("cam")=Var_var("cam"); Var_var("cam")=""; DoReactStr("MONITOR",Itv_var("mon"),"ACTIVATE_CAM","cam<"+Itv_var("cam")+">"); break; case 14: //Shot - go_preset DoReactStr("TELEMETRY",GetPTZdevice(Itv_var("cam")),"GO_PRESET","preset<"+Var_var("cam")+">,tel_prior<3>"); Itv_var("pre")=Var_var("cam"); Var_var("cam")=""; break; case 15: //Time - âûáîð âðåìåíè àðõèâà // DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); Var_var("cam")=""; break; case 16: //Setup - çàïèñü ïðåñåòà DoReactStr("TELEMETRY",GetPTZdevice(Itv_var("cam")),"SET_PRESET","preset<"+Var_var("cam")+">,tel_prior<3>"); DebugLogString("PTZ:"+GetPTZdevice(Itv_var("cam"))+" PRESET:"+Var_var("cam")); Itv_var("pre")=Var_var("cam"); Var_var("cam")=""; break; case 17: //F1 DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); break; case 18: //F2 DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); break; case 19: //F3 DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); break; case 20: //F4 DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); break; case 21: //F5 DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); break; } } } if (Event.SourceType=="TELEMETRY_EXT" && Event.Action=="MOVED") { if (Event.GetParam("guid_pk")!="") { var key=Event.GetParam("param0"); key=parseInt(key); var type=Event.GetParam("device"); //0-8312 1-8313 type=parseInt(type); DebugLogString("Device:"+type+" Key:"+key); } if (type==0) { if (key==-1) DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); else DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); } else { if (key>0) DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); if (key<0) DoReactStr("MONITOR",Itv_var("mon"),"KEY_PRESSED","key"); } } function GetPTZdevice(camId) { if (Var_var("PTZ_" + camId) == "") { DebugLogString("PTZ device for camera " + camId + " is unknown!"); var re = /id\.[0-9]+<(.+?)>/g; var sObjId = GetObjectIds("TELEMETRY"); var Id; while (Id = re.exec(sObjId)) { if (GetObjectParam("TELEMETRY",Id[1],"cam") == camId) { Lock(); Var_var("PTZ_" + camId) = Id[1]; Unlock(); DebugLogString("PTZ device for camera " + camId + " -- " + Id[1]); return Id[1]; } } } else { return Var_var("PTZ_" + camId); } }