I'm trying to convert my HS2 telephone script to HS3, but get multiple errors stating
Can someone point me to what needs to change for HS3?
Compiling script D:\HomeSeer HS3\scripts\CID_in_V01.vb: Reference to a non-shared member requires an object reference.
Code:
Sub Main(ByVal Parms As Object) dim cname dim cnumber Dim I As Integer Dim AddrBkIndex As Integer Dim intAdrCount As Integer = hsp.ADRCount Dim objContact As Scheduler.clsContact Dim strName As String Dim strAdrName As String Dim strNumber As String = "" Dim strAnnounce As String Dim CT_CIDFLAGS_BLOCKED as Boolean Dim Byte1, Byte2 As Byte Dim MyByte, MyBit cname = hs.LastCallerInfo(1) AddrBkIndex = 0 ' '*** Send to HSTouch *** hs.writelog("CIDNumber", "Script CID: " & hsp.cidnumber(1)) hs.setdevicestring("Z4", MkPhoneNum(hsp.cidnumber(1)), True) hs.SetDeviceLastChange("Z4", Now) hs.writelog("CIDName", "Script CID name: " & hsp.cidname(1)) hs.setdevicestring("Z3", cname, True) hs.SetDeviceLastChange("Z3", Now) hs.writelog("CIDName", "Script last-caller name: " & cname) hs.setdevicestring("Z5", " ", True) hs.SetDeviceLastChange("Z5", Now) '** HSP.HIPSendLocalCID(1,cname, hsp.cidnumber(1)) strName = hsp.CIDName(1) strNumber = hsp.CIDNumber(1) If strNumber.Length > 3 Then strNumber = strNumber.Substring(0, 3) & "-" & strNumber.Substring(3, 3) & "-" & strNumber.Substring(strNumber.Length - 4) End If hs.writelog("LookFor", strName & " " & strNumber) For I = 1 to intAdrCount 'Search the address book for a match objContact = hsp.ADRGet(I) ' hs.WriteLog "AdrEntry1", CStr(I) & " - " & objContact.FIRST & " " & objContact.LAST & " - " & objContact.cid_group_category ' hs.writelog("AdrEntry2", "Cell: " & objContact.cell_phone & " Home: " & objContact.home_phone ) '** if the phone number or the CID Name matches If objContact.cell_phone = strNumber OR objContact.home_phone = strNumber OR objContact.business_phone = strNumber OR objContact.cid_name = strName Then '** save index of the match AddrBkIndex = I '** test the "blocked" flag - if false, send CID info to phones CT_CIDFLAGS_BLOCKED = FALSE 'reset flag prior to testing CT_CIDFLAGS_BLOCKED = ExamineBit(objContact.CIDFLAGS, 1) If CT_CIDFLAGS_BLOCKED = FALSE HSP.HIPSendLocalCID(1,cname, hsp.cidnumber(1)) End if If CT_CIDFLAGS_BLOCKED = TRUE hs.setdevicestring("Z5", "Blocked", True) hs.SetDeviceLastChange("Z5", Now) End if hs.WriteLog("AdrMatch", CStr(I) & " - " & strNumber & " " & objContact.cid_name) ' Match found strAdrName = objContact.FIRST & " " & objContact.LAST strName = strAdrName '** special processing for entries marked as Family 'If objContact.cid_group_category = "Family" Then ' HSP.HIPSendLocalCID(1,cname, hsp.cidnumber(1)) ' strAnnounce = objContact.announce_local_wav ' hs.WriteLog("AdrMatchF", strAdrName) ' hs.Run("StartGeneralAnnounce.vb") ' hsp.WaitMS(100) ' hs.Speak(strAnnounce, True) ' hs.WaitSecs(1) ' hs.Speak(strName, True) ' hsp.WaitMS(100) ' hs.Run("RestoreRussoundGeneral.vb") ' End If I = intAdrCount End If Next '** if no match found in address book, index will be zero. If so, send CID info to phones If AddrBkIndex = 0 HSP.HIPSendLocalCID(1,cname, hsp.cidnumber(1)) hs.WriteLog("AdrMatch", CStr(I) & " No match found") ' No match found End if End Sub '********************************************************* Private Function MkPhoneNum(byVal number) Dim tmp number = CStr( number) number = Trim( number) number = Replace( number, " ", "" ) number = Replace( number, "-", "" ) number = Replace( number, "(", "" ) number = Replace( number, ")", "" ) Select Case Len( number ) Case 7 tmp = tmp & Mid( number, 1, 3 ) & "-" tmp = tmp & Mid( number, 4, 4 ) Case 10 tmp = tmp & "(" & Mid( number, 1, 3 ) & ") " tmp = tmp & Mid( number, 4, 3 ) & "-" tmp = tmp & Mid( number, 7, 4 ) Case 11 tmp = tmp & Mid( number, 1, 1 ) & " " tmp = tmp & "(" & Mid( number, 2, 3 ) & ") " tmp = tmp & Mid( number, 5, 3 ) & "-" tmp = tmp & Mid( number, 8, 4 ) Case Else MkPhoneNum = "Invalid" Exit Function End Select MkPhoneNum = tmp End Function '*********************************************************** Function ExamineBit(ByVal MyByte, ByVal MyBit) As Boolean Dim BitMask As Int16 BitMask = 2 ^ (MyBit - 1) ExamineBit = ((MyByte And BitMask) > 0) End Function
Comment