I am working on a HTA with VBScript, I am having trouble getting download progress from WGet or Aria2.
I have attempted to extract it from STDOUT with the following code, but it is giving me gibberish instead of the download bar to parse.
Const WshRunning = 0
Const WshFinished = 1
Const WshFailed = 2
Dim WshShellExec, Interval
Sub LaunchProcess
Cmd = "get/wget -O- http://cachefly.cachefly.net/100mb.test"
Set WshShellExec = CreateObject("WScript.Shell").Exec(Cmd)
Interval = window.setInterval(GetRef("UpdateStatus"),500)
End Sub
Sub UpdateStatus
Dim status
Set Status = Document.GetElementByID("Status")
Select Case WshShellExec.Status
Case WshRunning
status.InnerHTML = WshShellExec.StdOut.ReadLine()
Case WshFinished, WshFailed
status.InnerHTML = Replace(WshShellExec.StdOut.ReadAll(),vbCRLF,"<br>")
status.InnerHTML = "Done"
window.clearInterval(Interval)
Interval = Empty
End Select
End Sub
Not sure where I am going wrong? Or there alternate methods I could use? All I'm really after is a method to download a file and update a loading bar via percentage. Is that impossible within a HTA with VBScript or Javascript?
Thanks