by bomastudio » Sat Apr 28, 2012 11:59 am
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!!
-
bomastudio
-
- Posts: 53
- Joined: Mon Dec 14, 2009 4:38 pm
- Name: Alessandro Barracco
- Operating system: Linux
- SketchUp version: 8
- License type: Free
- SketchUp use: architecture
- Level of SketchUp: Advanced
by thomthom » Sat Apr 28, 2012 12:37 pm
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?
-

thomthom
- Global Moderator
-
- Posts: 17545
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: thomthom
- Operating system: Windows
- SketchUp version: 8
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by bomastudio » Sat Apr 28, 2012 12:59 pm
any ideas? maybe javascript can help me?
-
bomastudio
-
- Posts: 53
- Joined: Mon Dec 14, 2009 4:38 pm
- Name: Alessandro Barracco
- Operating system: Linux
- SketchUp version: 8
- License type: Free
- SketchUp use: architecture
- Level of SketchUp: Advanced
by bomastudio » Sat Apr 28, 2012 4:20 pm
(Re)looking in the documentation of SU API I found the get_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......
-
bomastudio
-
- Posts: 53
- Joined: Mon Dec 14, 2009 4:38 pm
- Name: Alessandro Barracco
- Operating system: Linux
- SketchUp version: 8
- License type: Free
- SketchUp use: architecture
- Level of SketchUp: Advanced
by thomthom » Sat Apr 28, 2012 5:18 pm
bomastudio wrote:(Re)looking in the documentation of SU API I found the get_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.
-

thomthom
- Global Moderator
-
- Posts: 17545
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: thomthom
- Operating system: Windows
- SketchUp version: 8
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by Brett McAllister » Tue May 01, 2012 8:08 pm
Add this piece of javascript to your html Should trigger when the dialog is fully loaded - Code: Select all
window.onload = function() { window.location.href ='skp:start@'; }
-
Brett McAllister
-
- Posts: 20
- Joined: Tue Dec 25, 2007 5:28 am
by thomthom » Wed May 02, 2012 8:21 am
Brett McAllister wrote:Add this piece of javascript to your html Should trigger when the dialog is fully loaded - Code: Select all
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.
-

thomthom
- Global Moderator
-
- Posts: 17545
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: thomthom
- Operating system: Windows
- SketchUp version: 8
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by Jim » Sat May 05, 2012 5:49 pm
thomthom wrote: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..?
-
Jim
- Global Moderator
-
- Posts: 4126
- Joined: Mon Nov 12, 2007 10:13 pm
- Location: NEOH
- Name: Jim
- Operating system: Windows
- SketchUp version: 8
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Intermediate
-
by bomastudio » Sat May 05, 2012 11:01 pm
Brett McAllister wrote:Add this piece of javascript to your html Should trigger when the dialog is fully loaded - Code: Select all
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....)?
-
bomastudio
-
- Posts: 53
- Joined: Mon Dec 14, 2009 4:38 pm
- Name: Alessandro Barracco
- Operating system: Linux
- SketchUp version: 8
- License type: Free
- SketchUp use: architecture
- Level of SketchUp: Advanced
by thomthom » Sat May 05, 2012 11:27 pm
Jim wrote:thomthom wrote: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/DO ... tentLoadedThough I just use jQuery these days - makes everything so much easier.
-

thomthom
- Global Moderator
-
- Posts: 17545
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: thomthom
- Operating system: Windows
- SketchUp version: 8
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by bomastudio » Mon May 14, 2012 9:32 am
I've just used the wget.exe tool. And it works!!  But I had some trouble with the system command.... 
-
bomastudio
-
- Posts: 53
- Joined: Mon Dec 14, 2009 4:38 pm
- Name: Alessandro Barracco
- Operating system: Linux
- SketchUp version: 8
- License type: Free
- SketchUp use: architecture
- Level of SketchUp: Advanced
by Ad Machine » 5 minutes ago
Need SketchUp Books, Models, Styles or Textures? Check out our One Stop Shop for SketchUp. Premium Members get 20% discount!
-
Ad Machine
- Robot
-
- Posts: 2012
-
Return to Developers' Forum
|