Announcement

Collapse
No announcement yet.

Jon00 HTML to Image Utility

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

    #46
    Pete,

    There seems no point copying a snapshot of the jpg if it already exists.

    Not tested but this vb.net script should do what you need:

    PHP Code:
    Sub Main(byVal Parm As Object)

    Dim Result As String hs.GetURL("http://localhost","/Temperature.asp?Page=trend",TRUE,<homeseer port>)
    'Wait 40 seconds for page to load
    For X As Integer = 1 to 40
        hs.waitsecs(1)
    Next
    My.Computer.FileSystem.CopyFile(hs.GetAppPath & "\html\mcsTemp\mcs192168244234Temp-OUT6.jpg",hs.GetAppPath & "\HTML\Images\wunderground\mcs.jpg",True)
    end sub 
    Last edited by jon00; September 17, 2011, 09:28 AM.
    Jon

    Comment


      #47
      Let me give that a try; thank you Jon.

      This is the test script that I am running:

      Sub Main(byVal Parm As Object)

      Dim Result As String = hs.GetURL("http://192.168.244.167","/Temperature.asp?Page=trend",TRUE,9999)
      'Wait 40 seconds for page to load
      For X As Integer = 1 to 40
      hs.waitsecs(1)
      Next
      My.Computer.FileSystem.CopyFile(hs.GetAppPath & "\html\mcsTemp\mcs192168244234Temp-OUT6.jpg",hs.GetAppPath & "\HTML\Images\wunderground\mcs2.jpg",overwrite)
      end sub
      This is the log entries I am seeing when running the script.

      9/17/2011 9:19:13 AM Event Running script and waiting: mcs-graph.vb
      9/17/2011 9:19:14 AM Error Script compile error: Name 'overwrite' is not declared.on line 21
      9/17/2011 9:19:14 AM SCR Option Strict Offimports Schedulerimports SystemPublic Module scriptcode20#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionSub Main(byVal Parm As Object) Dim Result As String = hs.GetURL("http://192.168.244.167","/Temperature.asp?Page=trend",TRUE,9999) 'Wait 40 seconds for page to load For X As Integer = 1 to 40 hs.waitsecs(1) Next My.Computer.FileSystem.CopyFile(hs.GetAppPath & "\html\mcsTemp\mcs192168244234Temp-OUT6.jpg",hs.GetAppPath & "\HTML\Images\wunderground\mcs2.jpg",overwrite) end sub End Module
      Last edited by Pete; September 17, 2011, 09:22 AM.
      - Pete

      Auto mator
      Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

      HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
      HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

      X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

      Comment


        #48
        Ops - change 'overwrite' to 'True'

        I've modified the existing script
        Jon

        Comment


          #49
          Worked!

          Thank-you Jon!
          - Pete

          Auto mator
          Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

          HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
          HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

          X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

          Comment


            #50
            Excellent!
            Jon

            Comment


              #51
              Jon,

              On a kind of similiar subject. For years now been grabbing weather pics from this site:

              http://twister.sbs.ohio-state.edu/lo...pid=GOES-13+IR

              The weather picture used to be always the same name and updated. Just recently they redid their site and the weather picture is now dynamic and changing all of the time; but its still in the same directory and always named similiar to this:

              http://twister.sbs.ohio-state.edu/wx...1110060941.png

              Is there a way to be able to grab the dynamically changing png picture via a script versus a screen grab?
              - Pete

              Auto mator
              Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

              HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
              HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

              X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

              Comment


                #52
                Originally posted by Pete View Post
                Jon,

                On a kind of similiar subject. For years now been grabbing weather pics from this site:

                http://twister.sbs.ohio-state.edu/lo...pid=GOES-13+IR

                The weather picture used to be always the same name and updated. Just recently they redid their site and the weather picture is now dynamic and changing all of the time; but its still in the same directory and always named similiar to this:

                http://twister.sbs.ohio-state.edu/wx...1110060941.png

                Is there a way to be able to grab the dynamically changing png picture via a script versus a screen grab?
                Maybe http://iecapt.sourceforge.net/ will work. I have it capturing traffic image data in the AM and PM so I can push the traffic images. Helps knowing which alternate route is more likely to work out.
                huggy_d1

                Automating made easy

                Comment


                  #53
                  The only thing is that its one png file embedded in the page and that is what is changing.

                  I mean I could just do a snapshot of the entire page; but if I could just grab the changing png only from the page it would be beneficial.
                  - Pete

                  Auto mator
                  Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

                  HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                  HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                  X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                  Comment


                    #54
                    Pete,

                    The page you have posted contains a javascript slide show viewer which rotates 11 png images. There is no animated gif file (you cannot animate png images btw) to download.
                    Jon

                    Comment


                      #55
                      Thank-you Jon.

                      I will utilize your application to get the pics.
                      - Pete

                      Auto mator
                      Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

                      HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                      HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                      X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                      Comment


                        #56
                        Version 1.0.3 has been released

                        Version 1.0.3 is now available.

                        You now have the option to set the captured web page width and height. This can prevent text wrap which could upset the position of an image that you are trying to grab.
                        Jon

                        Comment


                          #57
                          Still not runing JavaScript though?

                          :-)


                          For capturing the images along my drive to work, there is a java script page that will provide the images. Traffic Land http://www.trafficland.com/. No matter what I can not get any capture programs to work.

                          What I WAS able to do though, is I run iecapture (http://iecapt.sourceforge.net/) which "triggers" the java with my "individual-code" I signed up for (free to sign up for it. I think they mostly use it to keep commercial people from abusing it). This then authorizes that code for about 3-4ish hours, where a not-so-advanced browser can go in and access the java links as regular images. That is, ANY utility that I've tried (this one, or others) can access the java script served images!!

                          It was strange to discover that. However, wanted to post to anyone else in this trouble. I still find this utility to be the easiest to use and capture all this stuff!

                          --Dan
                          Last edited by drozwood90; December 11, 2011, 03:13 PM.
                          Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                          Comment


                            #58
                            interesting, I just upgraded the html2image script from 1.01 to th current 1.03. I've not accessed the java "webpages" since last ight about 9:30PM, which has been 18 hours. I went to the HStouch page, which triggers the HTML2Image script. On that page, I have a button tied to the event that runs iecapt. Which then allows me to pick when to run that external .exe file (I'm woried about memory leaks and what-not).

                            At any rate, at 18 hours, I should have to run IECAPT, BUT without issue the new version of HTML2IMAGE worked!

                            I do not know what the difference in the code is (from 1.01 to 1.03), but I wanted to let people know that it now works with java served images (at least from Traffic Land!).

                            --Dan
                            Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                            Comment


                              #59
                              spoke (typed?) too soon. I guess I'm not sure. The most reliable way was to just trigger the iecapt.exe, then I can do whatever I want with your html2image.

                              Oh well.

                              --Dan
                              Tasker, to a person who does Homeautomation...is like walking up to a Crack Treatment facility with a truck full of 3lb bags of crack. Then for each person that walks in and out smack them in the face with an open bag.

                              Comment


                                #60
                                Having a similiar issue here lately with one of my favorite weather radar picture sites. It used to be that I could just grab the generically named radar picture. The pictures changed but the names were the same.

                                The site went to a store a multiple pics static Java thing with the names displayed changing every few minutes.

                                I've been trying to capture the radar picture with Jon's utility and it only grabs the top header of the page. The IECap utility does exactly the same thing. Both will do it even if I extend the wait time to get the page. Its not really that big of a deal though as there are literally many many sites that offer similiar radar pictures.

                                They have a very colorful rendition:

                                http://twister.sbs.ohio-state.edu/lo...pid=GOES-13+IR

                                Comparison is just another rendition (which I utilize) but not really as colorful:

                                http://weather.unisys.com/satellite/sat_ir_enh_east.gif
                                - Pete

                                Auto mator
                                Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

                                HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                                HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                                X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                                Comment

                                Working...
                                X