Announcement

Collapse
No announcement yet.

CID_Search_Notify script comments

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • alphatech
    replied
    Great script

    This script is just perfect, thank you for sharing it with us. Would it be possible to add a condition based of a misc field in the address book to indicate if that contact would be sent via email notification or not? I have several people that I do not care to know when they call.

    Thanks.

    Leave a comment:


  • HomeTech
    replied
    I have since updated the script to speak Unknown Caller if it does not recieve a CID number from HS Phone.

    Thought I had this was in the first posted script package but did not work that way. Now it does.

    Leave a comment:


  • HomeTech
    replied
    Check your HS 2 log and let me know what number your CID device is recieving. I could then plug it in on my end and test.

    It may be

    I am thinking if it for some reason it is not getting an area code number to search for or possibly the area code it is looking for is not present in the list.

    It will look through the areacode text file and that Area code North NJ is at the top of the list first entry and speaks that.

    Also note that the area code list is not up to date

    Note script updated

    I have since set the script to announce CID name 4 times and it is adjustable to what ever you want
    Last edited by HomeTech; April 1st, 2006, 04:02 PM.

    Leave a comment:


  • pscott
    replied
    My too, everything is coming up as North New Jersey.
    Any Ideas?
    Thanks

    Leave a comment:


  • jjsmd
    replied
    Sorry, I found it.

    Leave a comment:


  • jjsmd
    replied
    Where is this script posted? I would love to try it out, if you don't mind.

    Leave a comment:


  • danielbo
    replied
    OK another Problem

    It really seems as if it is working pretty good. But now it is seeming that everything is coming up as north new jersey.
    Any Ideas?
    Thanks
    Dan

    Leave a comment:


  • danielbo
    replied
    Yhea Dan

    I was able to delete that section and all runs fine for me now. I am even getting the email notifications that I wasnt.
    LOVE IT !!!!!!!!

    Thanks guy, anything else you want me to try,just yell. I can be your worse nightmare.

    Really mean it, Thanks,
    Dan

    Leave a comment:


  • danielbo
    replied
    Set objMsg = hs.Plugin("Message Server&quot.SendObject

    I know its the line that says
    Set objMsg = hs.Plugin("Message Server").SendObject
    that is giving me the error, I believe I need to install a message server plugin.
    Would you know where I would find such a thing. I check updates.
    Thanks,
    Dan

    Leave a comment:


  • HomeTech
    replied
    oops your right I put my script that I was using which had email addresses in it.Thanks for telling me. I must have been half a sleep. All better now.

    No problem let me know how you make out.

    Leave a comment:


  • danielbo
    replied
    I will try this!!

    No way, I would never touch a good thing. I really think you did a great job and I hope more people will find it helpful and appreciate what you have done and you have been a great help to me.

    yourself@yourself.com. The one I copied the second time also has the endsub. So maybe I copied the wrong one. I will try it again, hopefully without errors. <O

    Thank you for your great help and good job.<O
    Dan<O

    Leave a comment:


  • HomeTech
    replied
    danielbo

    I checked the script its in what I posted. Did you modify the script by chance?

    Also
    Are you running HS2?

    Do you have the message server plugin installed?
    it may be why your getting this error. line 161 is right were Message server begins.
    'hs.Plugin(...)' in line 161 More info
    Last edited by HomeTech; March 25th, 2006, 08:39 AM.

    Leave a comment:


  • HomeTech
    replied
    Looks like part of the sript is missing between st=line and callname=Pay Phone

    st="<a name=" & Chr(34) & Left(callnmbr,3)

    pos=
    InStr(ac,st)

    st=
    Mid(ac,pos+25,30)

    pos2=
    InStr(st,":")

    If callname="Pay Phone"Then

    callname="Pay Phone" & Mid(st,1,pos2-1)

    Else

    Leave a comment:


  • danielbo
    replied
    I still have something wrong.

    I am still getting the error:

    <TABLE cellSpacing=2 cellPadding=0 width="100%" border=0><TBODY><TR><TD class=LOGType1 align=left colSpan=3>Error </TD><TD class=LOGEntry1 align=left colSpan=8>Running script, script run or compile error in file: CID_Search_Notify.txt424:Object required: 'hs.Plugin(...)' in line 161 More info: Object required: 'hs.Plugin(...)'

    Not sure why. I did find on the original that I copied, it didnt have a (end sub). But that did not get rid of this error. I am not getting it to say the state in not found by the erea code either. Maybe you could look at what I have and see if something still did not copy right.

    </TD></TR></TBODY></TABLE>
    Sub Main()
    dim i, line, adr_count, contact
    dim callname, callnmbr, dhit, addbk
    dim objMsg, strTitle, strMsg, strMsgSent
    dim num, p, tmp, url
    dim pg, nml, posl
    dim nmf, caller, ref
    dim ac, pos, pos2, st
    dim adnum, flag
    dim ct, tmr, num1, num2
    dim sec, f, fso, loops
    dim sl, old, callerid
    dim bedtime, path, bathtime
    sc=timer
    ' get the caller directory name
    callname = hsp.cidname(1)
    ' get the phone number
    callnmbr = hsp.cidnumber(1)
    'callnmbr=2604329996 'for testing
    'callname="O" 'for testing
    'hs.writelog "CID_Search_Notify DEBUG Phone Number Var",callnmbr
    if callname = "O" then
    callname = "*Out of Area"
    end if
    if callname = "P" then
    callname = "*Private"
    end if
    ' init the directory hit flag
    dhit = false
    ' number of address book entries
    adr_count = hsp.ADRCount
    ' reverse if last, first format
    if instr(1,callname,",") then
    callname = trim(hs.stringItem(callname,2,",")&" "&hs.stringItem(callname,1,","))
    end if
    if left(callnmbr,1) <> "*" then
    'Is it a CID message, skip formatting
    if instr(1,callnmbr,"-") = 0 then
    'Are the dashes missing?
    callnmbr = trim(callnmbr)
    'format it for voice if dashes are missing
    callnmbr = left(callnmbr,3)&"-"&mid(callnmbr,4,3)&"-"&right(callnmbr,4)
    end if
    end if
    for i = 1 to adr_count ' look thru address book for number
    set contact = hsp.ADRGet(i) ' get the reference to the addrbk entry
    select case callnmbr ' see if the number is in the book
    case contact.home_phone
    callname = contact.first&" "&contact.last ' pickup the name
    addbk = "Home number" ' denote the source
    dhit = true ' we had a hit in the address book
    exit for ' performance - exit loop if found
    case contact.cell_phone
    callname = contact.first&" "&contact.last
    addbk = "Cell number"
    dhit = true
    exit for
    case contact.business_phone
    callname = contact.first&" "&contact.last
    addbk = "Work number"
    dhit = true
    exit for
    case contact.home_phone_2
    callname = contact.first&" "&contact.last ' pickup the name
    addbk = "Home number 2" ' denote the source
    dhit = true ' we had a hit in the address book
    exit for ' performance - exit loop if found
    case contact.cell_phone_2
    callname = contact.first&" "&contact.last
    addbk = "Cell number 2"
    dhit = true
    exit for
    case contact.business_phone_2
    callname = contact.first&" "&contact.last
    addbk = "Work number 2"
    dhit = true
    exit for
    end select
    next
    if dhit = false then
    addbk = "AT&T directory"
    end if
    If callname="*Out of Area" or callname="O" or callname="*Private" or callname="P" or callname="Unavailable" Then callname=""
    If callname="" and callnmbr<>"" Then
    num1=Left(callnmbr,3)
    num2=Right(callnmbr,8)
    url="http://www.anywho.com/qry/wp_rl?npa=" & num1 & "&telephone=" & num2 & "&btnsubmit.x=22&btnsubmit.y=16"
    pg=hs.GetURL(url,"",FALSE,80)
    posl=InStr(pg,"<!-- listing -->")+83
    If posl=83 Then
    callname=""
    Else
    i=0
    nml=""
    tmp=Mid(pg,posl+i,1)
    While tmp <> "," and tmp <> "<"
    nml=nml & tmp
    i=i+1
    tmp=Mid(pg,posl+i,1)
    Wend
    If tmp <> "," Then
    nmf=""
    Else
    nmf=""
    i=i+2
    tmp=Mid(pg,posl+i,1)
    While tmp <> "<"
    nmf=nmf & tmp
    i=i+1
    tmp=Mid(pg,posl+i,1)
    Wend
    End If
    If InStr(nml,"TABLE BORDER=") <> 0 Then nml=""
    callname=nmf & " " & nml
    If callname=" " Then callname=""
    End If
    End If
    ac=""
    If (callname="" and callnmbr <> "") or callname="Pay Phone" Then
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.opentextfile("c:\program files\homeseer 2\scripts\areacode.txt",1)
    ac=f.readall
    f.Close
    st="<a name=" & Chr(34) & Left(callnmbr,3)
    pos=InStr(ac,st)
    st= Mid(ac,pos+25,30)
    pos2=InStr(st,":")
    If callname="Pay Phone" Then
    callname="Pay Phone" & Mid(st,1,pos2-1)
    Else
    callname="Area code" & Mid(st,1,pos2-1)
    End If
    End If
    hs.WriteLog "Caller Searched Result", callname
    If callname="" Then callname = "Unknown Caller."
    hs.Speak callname
    flag=0
    tmr=Timer
    ct=hsp.LINERingCount(1)
    While flag=0
    While ct=hsp.LINERingCount(1) and flag=0
    hs.WaitEvents
    If Timer-tmr > 10 or hsp.LINERingCount(1) > 3 Then flag=1
    Wend
    If flag=0 Then hs.Speak callname
    ct=hsp.LINERingCount(1)
    Wend
    '*********************************************************** *********************************
    ' Script: Derived from MS_SendMsg.txt v1.0.2 by Christian Yvinec
    '
    'objMsg.Data = strMsg 'The text message As String
    'objMsg.Title = strTitle 'Optional the title for ballons or MsgBox As String
    'objMsg.Icon = Alert 'Optional the image for ballons As Integer
    'objMsg.Balloons = true 'Optional show balloons As Boolean
    'objMsg.Mbox = true 'Optional show MsgBox As Boolean
    'objMsg.IP = "192.168.1.150" 'Optional To Client IP As String - null for all connected clients
    '
    'strMsgSent = objMsg.SendMsg 'Send the message to client (Return confirmation)
    '*********************************************************** *********************************
    Const None = 0, Info = 1, Alert = 2, Error = 3
    Set objMsg = hs.Plugin("Message Server").SendObject
    objMsg.Data = "Incoming Call from: " &callname &" "&callnmbr &" "&addbk ' The message to send
    objMsg.Title = callname
    objMsg.Icon = info ' Type of message
    objMsg.Balloons = False ' Use a popup balloon
    objMsg.Mbox = True ' Display only the balloon
    objMsg.IP = ""
    strMsgSent = objMsg.SendMsg ' send the message to the client(s)
    hs.writelog "MS sent", objMsg.data
    Set objMsg = Nothing
    Set ms = Nothing
    '*********************************************************** ***********************************
    'send an email to my cell phone which arrives in the form of a text message.
    TOaddress = "xxx@xxx.com"
    FROMaddress = "xxx@xxx.com"
    subject = "Incoming Call"
    body = "Caller: "&callname &" Number: "&callnmbr &" Description: "&addbk
    hs.SendEmail TOaddress, FROMaddress, subject, body
    '*********************************************************** ************************************
    'Put last caller info into a Device.
    virtualdevice = "z98"
    hs.SetDeviceString virtualdevice,"<img src=\Images\phone.gif>"&callname&" "&callnmbr&" "&addbk, True
    hs.WriteLog "Device updated Last Caller",callname & callnumbr & addbk

    end sub

    -----------------------------------------------------------------------------------------------------
    I have the ereacode.txt with in the script file and I am also running homeseer speaker.
    I have looked and couldnt find anything, but then again I am not real good at programing.
    Thanks and keep up the great work,
    Dan

    Leave a comment:


  • HomeTech
    replied
    Ok glad you are giving it a try. On your error it may be that you dont have the Message server plugin. I use that in the script to send CID info to clients. I use this while I am at work so I can see who is calling the house as well as what HS is doing all day.


    As far as anouncing both phone book entries and any who searches I have not had that hapen to me yet because I would guess maybe thats because most of the people that call me are UN-listed if there in my phone book. In any case it should not do a anywho search unless there is no phone book entry found.

    I will look and see if I missed something.

    Thanks
    Last edited by HomeTech; March 24th, 2006, 06:59 AM.

    Leave a comment:

Working...
X