sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Webdialog: set_url and write html in a file? how?

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 4 Posters 486 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • bomastudioB Offline
      bomastudio
      last edited by

      Hi all, I', not able to write the html loaded in a webdialog after I set its url:
      dlg = UI::WebDialog.new("mionome", false, "altro")
      url = "http://www.miosito.com"
      dlg.set_url(url)

      now I want to copy the html of the dlg in a file.txt without show the dialog??

      any help??

      Thanx!!

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        WebDialog doesn't give you access to the HTML content.

        And in addition I think there might be platform issues. Under OSX the website is loaded when you set_url, set_file, or set_html - before the dialog is displayed. (if I remember correctly.)
        Under Windows it doesn't happen until you display the webdialog.

        From what I gather - what you really want to do, is not display a webdialog, but get the content of a webpage?

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • bomastudioB Offline
          bomastudio
          last edited by

          any ideas?
          maybe javascript can help me?

          1 Reply Last reply Reply Quote 0
          • bomastudioB Offline
            bomastudio
            last edited by

            (Re)looking in the documentation of SU API I found theget_element_value method, used to get a value, with a given element_id, from the web dialog's DOM. So I think I can access to the html of the page......

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              @bomastudio said:

              (Re)looking in the documentation of SU API I found theget_element_value method, used to get a value, with a given element_id, from the web dialog's DOM. So I think I can access to the html of the page......

              Only works when the dialog is visible.

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • B Offline
                Brett McAllister
                last edited by

                Add this piece of javascript to your html
                Should trigger when the dialog is fully loaded

                window.onload = function() { 
                window.location.href ='skp;start@';
                }
                
                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  @brett mcallister said:

                  Add this piece of javascript to your html
                  Should trigger when the dialog is fully loaded

                  window.onload = function() { 
                  > window.location.href ='skp;start@';
                  > }
                  

                  But that triggers when all external CSS and images are loaded. I find it better to use the DOM event that triggers when the DOM tree is ready.

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jim
                    last edited by

                    @thomthom said:

                    But that triggers when all external CSS and images are loaded. I find it better to use the DOM event that triggers when the DOM tree is ready.

                    Which is..?

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • bomastudioB Offline
                      bomastudio
                      last edited by

                      @brett mcallister said:

                      Add this piece of javascript to your html
                      Should trigger when the dialog is fully loaded

                      window.onload = function() { 
                      > window.location.href ='skp;start@';
                      > }
                      

                      Please excuse me as I'm not precise in my posts..... 😳 😳 I have to use a web service: I must use a URL and the server send me a xml file (I used my btrrowser so I don't recognize that the web page was, in reality, a XML code..... forgive me..... 🤣 🤣

                      So now the question is: do you think is better to download that file in anyway or to process it in a webdialog (like I was trying....)?

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        @jim said:

                        @thomthom said:

                        But that triggers when all external CSS and images are loaded. I find it better to use the DOM event that triggers when the DOM tree is ready.

                        Which is..?

                        https://developer.mozilla.org/en/DOM/DOM_event_reference/DOMContentLoaded

                        Though I just use jQuery these days - makes everything so much easier.

                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • bomastudioB Offline
                          bomastudio
                          last edited by

                          I've just used the wget.exe tool. And it works!! But I had some trouble with the system command.... 😕

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post
                          Buy SketchPlus
                          Buy SUbD
                          Buy WrapR
                          Buy eBook
                          Buy Modelur
                          Buy Vertex Tools
                          Buy SketchCuisine
                          Buy FormFonts

                          Advertisement