Announcement

Collapse
No announcement yet.

Get_WAN_IP

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

    #16
    Using the script above....Where is the image computer.gif located RightNow? Because in order for it to be shown like that, the .gif would have to be in your homeseer/html directory.

    This will turn out to be something silly we will all laugh about later I'm sure..

    JustOneMore
    http://www.justonemore.us
    FreeWorldDialup desktop# 25831, PPC# 26420

    Comment


      #17
      I figured out the problem. There is a sight logic error in the script in that if you change you icon or the location the script will not work. The most simple solution is to put the icon where you want it and modify the code to point to that location. Then edit your settings.ini file removing the lines:
      [WAN IP]
      Address=xx.xxx.xx.xx

      Then rerun the script. It should then work from this point on.


      -Rupp

      Here's to all the unknown soldiers to whom we owe the freedom of today and everyday. Thanks.
      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

      Comment


        #18
        JustOneMore: The gif is in the html directory. As for laughing about this... not yet, but ya never know!

        Rupp: Thanks! I'll have to wait to get home to try that.

        Hey guys, I really appreciate all your help with this.

        Comment


          #19
          Rupp, YOU DA MAN! It works perfectly now, displaying the computer icon as it should. No errors in the log.

          I haven't examined the script to see what you are talking about, but I'm guessing that since the IP didn't change, it exits before it ever gets to line that sets the device graphic?

          I wasted waaaayyyy too many hours on this problem. What a first script for me to pick.

          Now that it's fixed, I'm off to install my just received W800RF32A. I hope this goes a lot better!

          Comment


            #20
            As the author of the script, I'm embarrased it cause so much trouble for you. Sorry for that. I think I should have mentioned in my post to be sure to click the extract button in winzip so the folder structure is created. I have seen others use this same method where you have a sort of 'package' to show where files go. It should have created the following:

            GetWANIP (Parent Folder)
            Html (Sub Folder)
            Images (Sub Folder)
            computer.gif (File)

            Scripts (Sub Folder)
            Get_WAN_IP.vbs (File)


            Dragging the files from the winzip window would not have shown you this.

            -Tom

            Visit my HomeSeer at http://68.55.67.82:81
            -Tom

            Visit Kernhome
            Kern Theater Gallery

            (User: guest / Pass: guest)

            Comment


              #21
              Here is the script as people are downloading it:

              '*********************************************************** ******************
              ' Script: Get_WAN_IP.vbs
              '*********************************************************** ******************
              ' Created on 03.25.03 by Tom Kern (tom-kern@comcast.net)
              ' Last Update On 04.14.03
              '*********************************************************** ******************
              ' Brief Description: This script gets your current WAN IP address by pulling
              ' up xml data from showmyip.com. The current IP is saved to the settings.ini
              ' And all future requests are compared for change. Once the IP changes, the
              ' ini Is updated And an SMS text email is sent.
              '
              ' Additional Notes: Before running this script, add a new device in HomeSeer
              ' and specify a virtual address. Change the Device constant below to your new
              ' device address. Also create an event and set it to run this script every
              ' hour or so. Finally, change the MailTo Const to your phone number or feel
              ' free To modify the script to do whatever action you see fit.
              ' Thanks For checking it out!
              '*********************************************************** ******************
              ' Revision History:
              '
              ' WHEN DESCRIPTION
              ' ---- -----------
              ' 04.14.03 Added code to save the IP to the HS Settings.ini and compare all
              ' new checks to old. Also, send an SMS Text message if the IP
              ' changes.
              '*********************************************************** ******************
              Option Explicit

              Const Device = "v1"
              Const MailTo = "mynumber@vtext.com"

              Sub Main()
              Dim NewIP, OldIP
              Dim URL

              ' Get Current WAN IP from xml.showmyip.com
              URL = Trim(hs.GetUrl("http://xml.showmyip.com", "/", True, 80))
              If URL <> "" Then
              'msgbox URL
              ' Parse new IP
              NewIP = Trim(Mid(URL, 1 , 15))
              NewIP = StripNonNumerics(NewIP)
              Else
              ' Failed
              Call hs.WriteLog("Get_WAN_IP.vbs", "Problem obtaining new IP Address from http://xml.showmyip.com")
              Exit Sub
              End If

              ' Get our current IP Address from the Settings.ini
              OldIP = Trim(hs.GetINISetting("WAN IP", "Address", ""))
              If OldIP <> "" Then
              ' If we have an Old IP on file, compare to NewIP
              If StrComp(NewIP, OldIP, 1) <> 0 Then
              ' Save new IP To ini
              hs.SaveINISetting "WAN IP", "Address", NewIP
              ' Set Device
              hs.SetDeviceString Device, "<img src='/images/computer.gif'>" & " WAN IP: " & NewIP
              Call hs.WriteLog("Get_WAN_IP.vbs", "WAN IP Address is " & NewIP)
              ' send an email to my cell phone which arrives in the form
              ' of a text message.
              hs.SendEmail MailTo, "", "New IP", NewIP
              End If
              Else
              ' Save new IP to Settings.ini
              hs.SaveINISetting "WAN IP", "Address", NewIP
              hs.SetDeviceString Device, "<img src='/images/computer.gif'>" & " WAN IP: " & NewIP
              Call hs.WriteLog("Get_WAN_IP.vbs", "WAN IP Address is " & NewIP)
              End If

              ' Set Last Change Date
              hs.setdevicelastchange Device, now()

              End Sub

              Function StripNonNumerics(SourceString)
              Dim sChar
              Dim Final
              Dim i

              ' Do for the length of SourceString
              For i = 1 To Len(SourceString)
              ' Get next character to compare
              sChar = Mid(SourceString, i, 1)
              ' See if our next char is a numeric or "."
              ' If not, make a new string with only the characters we want
              If IsNumeric(sChar) Or sChar = "." Then
              StripNonNumerics = StripNonNumerics & sChar
              End If
              Next

              End Function


              The line containing "<img rc='/images/computer.gif'>" expects that the graphic is located in HomeSeer\Html\Images. Seems like many scripts use this directory.

              Mike - sorry again for the trouble...

              -Tom

              Visit my HomeSeer at http://68.55.67.82:81

              [This message was edited by Tom Kern on Fri, 23 May 2003 at 08:37 PM.]
              -Tom

              Visit Kernhome
              Kern Theater Gallery

              (User: guest / Pass: guest)

              Comment


                #22
                <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>The line containing "&lt;img rc='/images/computer.gif'&gt;" expects that the graphic is located in HomeSeer\Html\Images. Seems like many scripts use this directory.

                Mike - sorry again for the trouble...<HR></BLOCKQUOTE>

                Hey, no problem. It was definitely a learning experience. I wasn't aware that many scripts use an images directory... yours was the first script I have used. And yeah, I probably manually extracted and placed the files where I thought they should go.

                By the way, this line...

                NewIP = Trim(Mid(URL, 1 , 15))

                Doesn't extract the entire IP, at least not for me. I was getting a WAN IP of 66.32.162, and the last three digit number was left off. Had to do a little tweaking there.

                Comment


                  #23
                  Grabbing 20 chars from the string is probably better. During my testing, the mid() function was right at the beginning of the IP address and returned the whole thing. So I specified 15 thinking that would be ok for IPs as big as: XXX.XXX.XXX.XXX

                  I guess the starting position must have been off or something.

                  -Tom

                  Visit my HomeSeer at http://68.55.67.82:81
                  -Tom

                  Visit Kernhome
                  Kern Theater Gallery

                  (User: guest / Pass: guest)

                  Comment


                    #24
                    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>I guess the starting position must have been off or something.<HR></BLOCKQUOTE>

                    Looks to me like the starting position should be 5, I think. Sounds logical since starting at the first position and taking 20 characters would accomplish the same thing as moving 5 in and taking 15 after you trim off all the non-numeric characters.

                    Comment


                      #25
                      When HS tries to send the mail there is the error no 'FROM'. All my other events email fine with mt return address showing in the log. Is there a place in the script I should be entering the return address in? The options page in HS seems to be set up okay on the Email tab.

                      Ed.

                      Comment


                        #26
                        <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by EDR:
                        When HS tries to send the mail there is the error no 'FROM'.<HR></BLOCKQUOTE>

                        Yeah, I ran into that same thing. Most ISP's won't accept an outgoing email with no "from" data.

                        Looks for this line in the script...

                        hs.SendEmail MailTo, "", "New IP", NewIP

                        And put your from address in between the quotes after MailTo. Or make a MailFrom const at the top of the script and use that in place of the quotes.

                        Comment


                          #27
                          I cann't get it to acess the website. When I try to goto the site in explore I get the famous page not found.

                          How are you guys getting around this.

                          Brian

                          Comment


                            #28
                            I have a new version I will upload shortly. Let me test one quick thing and I will post when its ready. The new version uses a different site to get the primary address from and also has an alternate site it tries if the primary is down. I'll reply here again when its up.

                            -Tom

                            Visit my HomeSeer at http://68.55.67.82:81 (New Guest Downloads!)
                            -Tom

                            Visit Kernhome
                            Kern Theater Gallery

                            (User: guest / Pass: guest)

                            Comment


                              #29
                              The new version is available for download in the original thread HERE

                              Please let me know if you have any problems with it. Thanks.

                              -Tom

                              Visit my HomeSeer at http://68.55.67.82:81 (New Guest Downloads!)
                              -Tom

                              Visit Kernhome
                              Kern Theater Gallery

                              (User: guest / Pass: guest)

                              Comment


                                #30
                                Worked real easy. I like having it display since I have been toying around with a remote admin program lately.

                                Also checked out your site for some idea's.

                                Brian

                                Comment

                                Working...
                                X