[Gambas-user] WebDownload
Gianluigi
bagonergi at gmail.com
Fri May 11 17:19:37 CEST 2018
2018-05-11 16:20 GMT+02:00 Charlie Ogier <charlie at cogier.com>:
> 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>:
>
>>
>>
>> 2018-05-10 17:56 GMT+02:00 Ingo <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#
>>>>
>>>> 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
>>>>
>>>> Search the list:
>>>> 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"
>>> <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
>
Hi Charlie,
congratulations, smart solution :-)
Regards
Gianluigi
>
>>> --------------------------------------------------
>>>
>>> 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
>>>
>>>
>>
>>
>> --------------------------------------------------
>>
>> 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
>>
>>
>
>
> --------------------------------------------------
>
> 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
>
>
>
>
> --------------------------------------------------
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180511/1e018f96/attachment.html>
More information about the User
mailing list