Moved from HS3 Linux to HS3 windows. After that I will move to HS4 windows. Doing the upgrade in steps for minimal loss of service. So far so good. Looks like everything is back except some custom scripts I had in the Linux box no longer work in the windows environment. Here is the script. I stole from the forms it years back when I first started with HS and modified it slightly for my needs. It is a simple countdown script for my gate hold open timer.
Sub Main(ByVal pram as Object)
Dim StartVar as string ' Set this to the countdown starting value
Dim pram as string
Dim test as string
'test = hs.CAPIGetStatus(18).Value
'hs.writelog("Value", + test)
pram = hs.CAPIGetStatus(18).Value
If pram = 300 then
pram = 3600
End if
If pram = 400 then
pram = 7200
End if
If pram = 500 then
pram = 10800
End if
IF pram = 600 then
pram = 180
End if
'IF pram = 600 then
'pram = 2
'End if
StartVar = pram
Dim x as Integer
'hs.writelog("StartTime", + StartVar)
'hs.writelog("pram ", + pram )
x = Convert.ToInt32(hs.TimerValue("GATE HOLD").TotalSeconds)
'hs.writelog("X", + x)
'hs.SetDeviceValueByRef(16, StartVar - x, True)
'hs.SetDeviceString(16, StartVar - x & " seconds", True)
'hs.writelog("Utility Countdown","Updating")
Dim hms as TimeSpan = TimeSpan.FromSeconds(StartVar - x)
Dim h = hms.Hours.ToString
Dim m = hms.Minutes.ToString
Dim s = hms.Seconds.ToString
hs.SetDeviceString(197, h & ":" & m & ":" & s, True)
'hs.SetDeviceString(16, m & " min " & s & " sec", True)
hs.SetDeviceValueByRef(197, StartVar - x, True)
'hs.SetDeviceString(18, h & ":" & m & ":" & s, True)
' hs.SetDeviceValueByRef(18, StartVar - x, True)
If x >= StartVar then
hs.WaitSecs(1)
hs.SetDeviceValueByRef(197, StartVar, True)
'hs.SetDeviceString(16, StartVar & " seconds", True)
hs.SetDeviceValueByRef(18, 0, True) 'Set to Close
hs.SetDeviceString(197, 0, True)
'hs.SetDeviceString(18, 0, True)
'hs.SetDeviceString(18, "", True) ' Fix for Bad Device String
hs.CAPIControlHandler(hs.CAPIGetSingleControl(97, true, "Off", false, true))
hs.WaitSecs(2)
hs.CAPIControlHandler(hs.CAPIGetSingleControl(97, true, "Off", false, true))
End If
End Sub
Andy
Sub Main(ByVal pram as Object)
Dim StartVar as string ' Set this to the countdown starting value
Dim pram as string
Dim test as string
'test = hs.CAPIGetStatus(18).Value
'hs.writelog("Value", + test)
pram = hs.CAPIGetStatus(18).Value
If pram = 300 then
pram = 3600
End if
If pram = 400 then
pram = 7200
End if
If pram = 500 then
pram = 10800
End if
IF pram = 600 then
pram = 180
End if
'IF pram = 600 then
'pram = 2
'End if
StartVar = pram
Dim x as Integer
'hs.writelog("StartTime", + StartVar)
'hs.writelog("pram ", + pram )
x = Convert.ToInt32(hs.TimerValue("GATE HOLD").TotalSeconds)
'hs.writelog("X", + x)
'hs.SetDeviceValueByRef(16, StartVar - x, True)
'hs.SetDeviceString(16, StartVar - x & " seconds", True)
'hs.writelog("Utility Countdown","Updating")
Dim hms as TimeSpan = TimeSpan.FromSeconds(StartVar - x)
Dim h = hms.Hours.ToString
Dim m = hms.Minutes.ToString
Dim s = hms.Seconds.ToString
hs.SetDeviceString(197, h & ":" & m & ":" & s, True)
'hs.SetDeviceString(16, m & " min " & s & " sec", True)
hs.SetDeviceValueByRef(197, StartVar - x, True)
'hs.SetDeviceString(18, h & ":" & m & ":" & s, True)
' hs.SetDeviceValueByRef(18, StartVar - x, True)
If x >= StartVar then
hs.WaitSecs(1)
hs.SetDeviceValueByRef(197, StartVar, True)
'hs.SetDeviceString(16, StartVar & " seconds", True)
hs.SetDeviceValueByRef(18, 0, True) 'Set to Close
hs.SetDeviceString(197, 0, True)
'hs.SetDeviceString(18, 0, True)
'hs.SetDeviceString(18, "", True) ' Fix for Bad Device String
hs.CAPIControlHandler(hs.CAPIGetSingleControl(97, true, "Off", false, true))
hs.WaitSecs(2)
hs.CAPIControlHandler(hs.CAPIGetSingleControl(97, true, "Off", false, true))
End If
End Sub
Andy
Comment