[Gambas-user] WebDownload

Ingo bm.530502 at gmail.com
Fri May 11 20:31:56 CEST 2018


Am 11.05.2018 um 16:20 schrieb Charlie Ogier:
> On 11/05/18 15:17, M Be wrote:
>> No problem. Thanks for your help, though.
>> I found a workaround with HttpClient for this application case.
>>
>> @Lee:  if you are reading this, maybe you have an explanation/solution
>>
>> Best regards
>> Ingo
>>
>> 2018-05-10 23:47 GMT+02:00 Gianluigi <bagonergi at gmail.com 
>> <mailto:bagonergi at gmail.com>>:
>>
>>
>>
>>     2018-05-10 17:56 GMT+02:00 Ingo <bm.530502 at gmail.com
>>     <mailto:bm.530502 at gmail.com>>:
>>
>>         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
>>>         <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
>>>         <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 byhttps://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"
>>         <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
>>
>>
>>     I'm sorry but I'm not able
>>     We hope in Lee
>>     Regards
>>     Gianluigi
>>
>>      Try the attached
>>
>         Charlie
>>
>>
>>         --------------------------------------------------
>>
>>         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
>>     <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 byhttps://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
Hi Charlie,
nice :-)

What was new for me is to store the picture data within a string.

Thanks
Ingo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180511/8ea3d9a9/attachment-0001.html>


More information about the User mailing list