Notifications
Clear all
[Closed] WebClient DownloadProgressChanged event in maxscript?
Feb 23, 2018 8:21 am
Hi,
I am trying using WebClient to download some file,I want to display the progress of how much percent bytes received,what I don’t know is write DownloadProgressChanged event in maxscript,below are some c# example:
https://ourcodeworld.com/articles/read/227/how-to-download-a-webfile-with-csharp-and-show-download-progress-synchronously-and-asynchronously
https://stackoverflow.com/questions/11522577/webclient-downloadfileasync-how-can-i-display-download-speed-to-the-user
My codes of DownloadProgressChanged event is:
wc=dotnetobject "System.Net.WebClient"
Fn get_download_data sender ee=
(
--get downloaded bytes or percent
)
dotNet.addEventHandler wc "DownloadProgressChanged" get_download_data
wc.downloadFile "<some url>" "c:\ est_download.zip"
It does not work,so how to fix it?Thanks!
2 Replies
Feb 23, 2018 8:21 am
(
url = @"http://speedtest.ftp.otenet.gr/files/test10Mb.db"
wc = dotnetobject "System.Net.WebClient"
fn get_download_data sender ev =
(
format "%
" (ev.ProgressPercentage)
)
dotNet.addEventHandler wc "DownloadProgressChanged" get_download_data
wc.downloadFile[b]Async[/b] (dotNetObject "system.uri" url) "c:\ est10Mb.db"
)
1 Reply