No announcement yet.


  • Filter
  • Time
  • Show
Clear All
new posts


    I'm new to working with scripts and the scripting language, though I've done some pascal programming in years gone by.

    I'm trying out the Get_WAN_ip script but can't seem to get it to place the computer icon on the web page. I get the dreaded red X in place of it.

    Here's the error I get in my log when the script runs...

    Web Server Error 404, cannot serve file: C:\Program Files\HomeSeer\html/html/images/computer.gif

    And here's the line that gets the image file...

    hs.SetDeviceString Device, "<img src='/images/computer.gif'>" & " WAN IP: " & NewIP

    But I gotta tell you, I've tried every iteration of a path I could think of and I still get the same error with the exact same weird path.

    The script seems to work fine otherwise.

    Have you tried moving the image to the html directory temporarily to see if it will load from there?



      Yes, it is in the HTML directory. And of course I've changed the reference to read...

      <img src='/html/computer.gif'>

      Funny part is, no matter what I put as the path to the image, the log always reports that error with that weird path.


        If its in the html directory you do not need a path.



          Tried that too. In fact, that's how it currently exists in the script. Here's the line...

          hs.SetDeviceString Device, "<img src='computer.gif'>" & " WAN IP: " & NewIP

          That statement exists in two places in the script. They both are identical.

          It seems to work fine otherwise. It gets my IP and puts it on the status page. However, it just displays a red X for the image and puts that error message in the log. Here's the log entry from just a few moments ago...

          5/23/2003 7:17:59 AM~!~Event Trigger~!~External Trigger (Get IP) v1 On (Dining Room Computer IP)

          5/23/2003 7:18:12 AM~!~Error~!~Web Server Error 404, cannot serve file: C:\Program Files\HomeSeer\html/html/images/computer.gif


            I hate to ask this question because I do not want to offend you but is the file computer.gif in your html directory? Also, I would try another gif just to make sure there is nothing wrong with that gif file.



              Just a suggestion. Try clicking on the gif itself to see if it opens up. Rupp's right, gif might be corrupt.

              FreeWorldDialup desktop# 25831, PPC# 26420


                No offense taken! I know I've done stupid things like that. :-) Yes, computer.gif is in the html directory and I have opened the gif because I was curious as to what it looked like. It opened fine.

                To me, the obvious problem is the path...

                C:\Program Files\HomeSeer\html/html/images/computer.gif

                What kind of path is that? Duplicate references to the html directory, a reference to an images directory (which doesn't exist as best I can recall).


                  <img src='html/computer.gif'>



                    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>&lt;img src='html/computer.gif'&gt;

                    Been there. I've tried...

                    c:\program files\homeseer\html\computer.gif

                    And also with just the filename, no path. I always get that same weird path in the logged error.


                      Can you try another gif and see if it works?


                      Why is the third hand on a watch called a second hand?


                        After trying another gif:

                        Again...sorry if you already went through this all, it kinda has me baffled.

                        When you change the src of the image, you do realize that it is called TWICE in the script, correct?

                        Secondly. Lets try to get back to original. In your html folder of HS create a folder called images (just in case it's not already there) then put the computer.gif file in there. Change the script back to
                        &lt;img src='/images/computer.gif'&gt; in BOTH places.

                        Who knows! hehe

                        FreeWorldDialup desktop# 25831, PPC# 26420


                          I'll go back to square one when I get home, but for now, here's some additional info.

                          I know that the image is referenced twice in the script. I make equal changes in both places ever time I change things.

                          I wrote to Rich and he said HomeSeer does not use any "images" directory, and is not capable of generating a path like that. And that it must be a script or plugin I'm running.

                          The only plugins I use are for the MR26A and the Powerlinc USB interface. As for scripts, this is the only one. I run no other scripts whatsoever and never have up until this one.

                          Here is what I tried. I deleted the reference to the script get_wan_ip.vbs. Instead, in that input box on the script tab, I put just a single line, like so..

                          &hs.SetDeviceString Device, "&lt;img src='computer.gif'&gt;" & " WAN IP: " & NewIP

                          SAME ERROR! And now that it's just a single line, I'm running NO scripts, just that single statement. And, the error has the same weird path.

                          However, if I view this event through the web interface, I see that single line under "scripts" for that event AND in place of "img src='computer.gif' it displays the graphic of the little computer! But the "status" page still displays the red X in its place.

                          I looked through settings.ini and everything looks fine there. The app path to homeseer is correct.

                          Here's something else I discovered. The default for this script for the device is V1. But according to something I read somewhere, virtual devices are numbers higher than 16. So, I changed it to V17 in the script and changed the device to V17.

                          After that, no more error, but then it appears the script isn't even executing. In the status webpage, the device icon appears as a lit up lightbulb and it just says ON. There's no "WAN IP: xx.xx.xx.xx" as there is when it was set to V1.

                          I have no idea what all this means. I can't believe this can be that difficult!

                          Is there any way to increase the debugging info?


                            YIKES! I hope you have a lot of hair to start off with.

                            FreeWorldDialup desktop# 25831, PPC# 26420


                              Here's the script I'm using in its entirety. Maybe I changed something that I'm blind to? Note that I changed the virtual device back to V1, since at least the script works that way, even if the graphic is just an X.

                              Note that I also had to change this... Trim(Mid(URL, 1 , 20)) slightly since it wasn't getting the entire IP,just the first three places. I could have moved the point where it began to parse for the IP, but I haven't gotten around to that yet.

                              '*********************************************************** ******************
                              ' Script: Get_WAN_IP.vbs
                              '*********************************************************** ******************
                              ' Created on 03.25.03 by Tom Kern (
                              ' Last Update On 04.14.03
                              '*********************************************************** ******************
                              ' Brief Description: This script gets your current WAN IP address by pulling
                              ' up xml data from 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 = ""

                              Sub Main()
                              Dim NewIP, OldIP
                              Dim URL

                              ' Get Current WAN IP from
                              URL = Trim(hs.GetUrl("", "/", True, 80))
                              If URL &lt;&gt; "" Then
                              'msgbox URL
                              ' Parse new IP
                              NewIP = Trim(Mid(URL, 1 , 20))
                              NewIP = StripNonNumerics(NewIP)
                              ' Failed
                              Call hs.WriteLog("Get_WAN_IP.vbs", "Problem obtaining new IP Address from")
                              Exit Sub
                              End If

                              ' Get our current IP Address from the Settings.ini
                              OldIP = Trim(hs.GetINISetting("WAN IP", "Address", ""))
                              If OldIP &lt;&gt; "" Then
                              ' If we have an Old IP on file, compare to NewIP
                              If StrComp(NewIP, OldIP, 1) &lt;&gt; 0 Then
                              ' Save new IP To ini
                              hs.SaveINISetting "WAN IP", "Address", NewIP
                              ' Set Device
                              hs.SetDeviceString Device, "&lt;img src='computer.gif'&gt;" & " 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
                              ' Save new IP to Settings.ini
                              hs.SaveINISetting "WAN IP", "Address", NewIP
                              hs.SetDeviceString Device, "&lt;img src='computer.gif'&gt;" & " 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

                              End Function