I wrote this script to download files from a website.
However, using UrlDownloadToFile will slow down the GUI, which may stop responding.
For example, if UrlDownloadToFile is in progress, dragging the window by the title bar pauses

Code: Select all
; GUI becomes irresponsive
; UrlDownloadToFile, % url, % filepath
; GUI smooth as butter
RunWait, %A_ScriptDir%\download.vbs "%url%" "%filepath%"
download.vbs:
Code: Select all
Dim xHttp : Set xHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
Dim bitStream : Set bitStream = CreateObject("Adodb.Stream")
xHttp.Open "GET", WScript.Arguments(0), False
xHttp.Send
If xHttp.status = 200 Then
With bitStream
.type = 1 'binary
.Open
.Write xHttp.responseBody
.SaveToFile WScript.Arguments(1) , 2
.Close
End With
End If
Is there a way to download *binary* (not text) files in AHK without hanging the GUI?