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.
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    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.
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        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
            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

            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 on a Raspberry Pi4
                  54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
                  Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

                  HSTouch Clients: 1 Android

                  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.
                        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                        Comment

                        Working...
                        X