[Gambas-user] WebDownload
Ingo
bm.530502 at gmail.com
Thu May 10 17:56:44 CEST 2018
Am 10.05.2018 um 15:15 schrieb Gianluigi:
> Hi Gianluigi,
>
> ok. I will try it.
>
> Saying we browse to the Gambas-Web-Page -
> http://gambas.sourceforge.net/en/main.html#
> <http://gambas.sourceforge.net/en/main.html#>
>
> Among other things we see the Donate-Logo. Clicking the right
> mouse button over the the logo I'm able to save this picture. That
> means user's interaction.
>
> But what I do, is to give the webpage to an htmldocument
> (htmldoc.FromString(WebView.HTML)).
> That works.
>
> Then parsing the htmldoc with the gb.xml.html component to find
> the source of the picture. Here it is
> "https://www.paypal.com/en_GB/i/btn/btn_donate_LG.gif"
> <https://www.paypal.com/en_GB/i/btn/btn_donate_LG.gif> and
> download this picture directly.
> Finding the link is not the problem. But downloading the picture.
> And here I thought I could use WebDownload.
>
> Hope that makes it a bit clearer.
>
> Best regards
> Ingo
>
>
>
> Are you looking for this [0]?
>
> [0] https://lists.gambas-basic.org/pipermail/user/2018-March/063237.html
>
> Regards
> Gianluigi
>
>
>
>
>
>
> --------------------------------------------------
>
> This is the Gambas Mailing List:
> https://lists.gambas-basic.org/listinfo/user
> <https://lists.gambas-basic.org/listinfo/user>
>
> Search the list:
> https://lists.gambas-basic.org/cgi-bin/search.cgi
> <https://lists.gambas-basic.org/cgi-bin/search.cgi>
>
> Hosted by https://www.hostsharing.net
>
>
>
>
> --------------------------------------------------
>
> This is the Gambas Mailing List:
> https://lists.gambas-basic.org/listinfo/user
>
> Search the list:
> https://lists.gambas-basic.org/cgi-bin/search.cgi
>
> Hosted by https://www.hostsharing.net
Thank you for the example.
Did you try it?
It does not work :-(
First I have to declare Downlad as New WebDownload and then it hangs in
the While Download.Progress loop.
I started the module from FMain with "picLoader.Main()"
No idea what happens???
=== picLoader.Module====
Private Download As New WebDownload ' declare as New
WebDownload because I get a "Null"-Object
Public Sub Main()
Dim hForm As Form
Dim hWebview As WebView
hForm = New Form As "Form1"
hWebview = New WebView(hForm) As "Webview1"
hWebview.Url = "https://www.paypal.com/en_GB/i/btn/btn_donate_LG.gif"
'First wait for Url to load
While hWebview.Progress < 1
Wait 0.1
Wend
'Then wait for download to finish
While Download.Progress < 1
Print Download.Progress ' here it loops!
Wait 0.1
Wend
'Wait 3
Select Case Download.Status
Case WebDownload.Cancelled
Print "Cancelled"
Case WebDownload.Error
Print "Error: " & Download.ErrorText
Case WebDownload.Finished
Print "Downloaded " & Download.Size & " bytes."
End Select
End
Public Sub Webview1_Download(thisDownload As WebDownload)
' We shouldn't use Wait in an event handler, so we pass the Download
object into the module scope
Download = thisDownload
Download.Path = Application.Path &/ "pic.png"
End
Regards
Ingo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180510/903bdb66/attachment-0001.html>
More information about the User
mailing list