Announcement

Collapse
No announcement yet.

Replace all numbers

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

    Replace all numbers

    I currently have Homeseer announcing caller ID by name or by phonebook entry. Sometimes calls come in with the caller ID being the phone number. I'd like a script to replace any phone number that might appear in the device string with a single entry like: "No advanced Caller ID information"

    I cant figure out how to do a replace that would cover any number and change it to a single phrase.

    Any help?

    Thanks
    ______________________________
    Skibumsplace - Locate Me

    #2
    Check out the isNumeric call. You could loop through the characters and if any of them are isNumeric then announce your phrase.
    -Rupp
    sigpic

    Comment


      #3
      I'm there... but not smart enough to apply that to a device string.
      ______________________________
      Skibumsplace - Locate Me

      Comment


        #4
        Post me an example device string and I'll work it up.
        -Rupp
        sigpic

        Comment


          #5
          The device string in question would be a phone number...

          Typically xxxxxxxxxx or xxxxxxxxxxx

          I just want to convert to a given string is there are ANY numbers present.

          Dim callerId2 as String is the string is question.
          ______________________________
          Skibumsplace - Locate Me

          Comment


            #6
            Dim i
            Dim callerId2
            callerId2 = "a23 v55-1212"
            For i = 0 To Len(callerId2)
            If IsNumeric(callerId2(i)) Then
            ' This is a number speak an alternate phrase
            MsgBox("This is a number")
            End If
            Next
            -Rupp
            sigpic

            Comment


              #7
              I'll see if I can figure that out.. Thanks!
              ______________________________
              Skibumsplace - Locate Me

              Comment


                #8
                If I replace the msgbox with a hs.speak, it speaks for each digit found in the string..

                Suggestions?
                ______________________________
                Skibumsplace - Locate Me

                Comment


                  #9
                  Originally posted by Rupp View Post
                  Dim i
                  Dim callerId2
                  callerId2 = "a23 v55-1212"
                  For i = 0 To Len(callerId2)
                  If IsNumeric(callerId2(i)) Then
                  ' This is a number speak an alternate phrase
                  MsgBox("This is a number")
                  End If
                  Next
                  you need to dim callerid2 as an array - you're referencing it as an array, but it is a string.
                  HS4Pro Running on a Raspberry Pi4
                  68 Z-Wave Nodes, 175 Events, 359 Devices
                  UPB modules via OMNI plugin/panel
                  Plugins: Z-Wave, OMNI, HSTouch, weatherXML, EasyTrigger
                  HSTouch Clients: 3 Android, 1 Joggler

                  Comment


                    #10
                    I got it... thanks for all of your help.
                    ______________________________
                    Skibumsplace - Locate Me

                    Comment


                      #11
                      You could also have a read here.
                      sigpic
                      A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

                      Comment


                        #12
                        Originally posted by rmasonjr View Post
                        you need to dim callerid2 as an array - you're referencing it as an array, but it is a string.
                        Whoops, I did this in vb.net and took off the datatype. Sorry.
                        -Rupp
                        sigpic

                        Comment

                        Working...
                        X