Hi !
Ist there any way to get this VBS Script working with the Home Center 2, maybe as virtual Device, to set and unset the alarm and Display the status ?
The following is a working VBS Script, i am not good a programming...
'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2007
'
' NAME: ipsecvest.vbs
'
' AUTHOR: Dietmar Klein
' DATE : 29.12.2011
'
' COMMENT:
'
'==========================================================================
'On Error Resume Next
If WScript.Arguments.Count <> 4 Then WebError("Wrong number of arguments")
strHost=WScript.Arguments(0)
strUsername=WScript.Arguments(1)
strPassword=WScript.Arguments(2)
strCmd=WScript.Arguments(3)
strOverview="getOverviewStatus.cgi"
strStatus="getMode.cgi?Source=Webpage"
strIntern="setMode.cgi?Mode=PartSet&Source=Webpage"
strExtern="setMode.cgi?Mode=Set&Source=Webpage"
strOff="setMode.cgi?Mode=Unset&Source=Webpage"
strNative=Right(strCmd,Len(strCmd)-6)
set objHttp = WScript.CreateObject("WinHttp.WinHttpRequest.5.1")
If objHttp Is Nothing Then Set objHttp = WScript.CreateObject("WinHttp.WinHttpRequest")
LogonSecvestIP strHost,strUsername,strPassword
Select Case lcase(strCmd)
Case "overview"
wscript.Echo CmdSecvestIP(strHost,strOverview)
Case "status"
If left(CmdSecvestIP(strHost,strStatus),10) = "Mode=Unset" Then WScript.Echo left(CmdSecvestIP(strHost,strStatus),10)
Case "intern"
tempStatus=CmdSecvestIP(strHost,strStatus)
If left(TempStatus,12)<>"Mode=PartSet"Then
If left(TempStatus,10)="Mode=UnSet" Then
CmdSecvestIP strHost,strIntern
else
CmdSecvestIP strHost,strIntern
Do While instr(CmdSecvestIP(strHost,strStatus),"Mode=Busy") > 0
wscript.sleep 500
Loop
CmdSecvestIP strHost,strIntern
End If
End If
Do While instr(CmdSecvestIP(strHost,strStatus),"Mode=Busy") > 0
wscript.sleep 500
Loop
WScript.Echo CmdSecvestIP(strHost,strStatus)
Case "extern"
tempStatus=CmdSecvestIP(strHost,strStatus)
If instr(TempStatus,"Mode=Set")=0 Then
If instr(TempStatus,"Mode=UnSet")<0 Then
CmdSecvestIP strHost,strExtern
else
CmdSecvestIP strHost,strExtern
Do While instr(CmdSecvestIP(strHost,strStatus),"Mode=Busy") > 0
wscript.sleep 500
Loop
CmdSecvestIP strHost,strExtern
End If
End If
Do While instr(CmdSecvestIP(strHost,strStatus),"Mode=Busy") > 0
wscript.sleep 500
Loop
WScript.Echo CmdSecvestIP(strHost,strStatus)
Case "off"
CmdSecvestIP strHost,strOff
Do While instr(CmdSecvestIP(strHost,strStatus),"Mode=Busy") > 0
wscript.sleep 500
Loop
WScript.Echo CmdSecvestIP(strHost,strStatus)
Case Else
If Left(strCmd,6)<>"native" Then WebError("Unknown command")
strCmd=Right(strCmd,Len(strCmd)-6)
WScript.Echo CmdSecvestIP(strHost,strCmd)
End Select
Function LogonSecvestIP(strHost,strUsername,strPassword)
objHttp.Open "POST", "http://"&strHost&"/login.cgi"
objHttp.Send "Language=english&UserName="&strUsername&"&Password="&strPassword
strResponse=objHttp.ResponseText
End Function
Function CmdSecvestIP(strHost,strCmd)
objHttp.Open "GET", "http://"&strHost&"/"&strCmd
objHttp.Send ""
If Not (objHttp.statusText = "OK") Then
WScript.Echo "Error: " & objHttp.statusText
WScript.Quit
Else
CmdSecvestIP=objHttp.ResponseText
End If
End Function
Function WebError(Errormessages)
WScript.echo Errormessages
WScript.Quit
End Function