Jump to content

MuddyPiglet

Members
  • Posts

    2
  • Joined

  • Last visited

MuddyPiglet's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I'm trying to create an auto-downloader for the latest Malwarebytes from their official website. However, every time I try it fails to download the entire file and trying to run it will show: Here was my code: #RequireAdmin ; Call a function and pass arguments: Call("DownloadFromLink", "https://www.malwarebytes.com/mwb-download/thankyou/", "MBSetup.exe", 1, 1) Func DownloadFromLink($sUrl, $sFilename, $i1, $i2) ; Try to download from the URL & store the return handler in $hDownload. Local $hDownload = InetGet($sUrl, $sFilename, $i1, $i2) EndFunc ;===>DownloadFromLink I then tried copy/pasting someone else's code temporarily for debugging purposes to determine if there were errors when it was being downloaded: #include <InetConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #RequireAdmin ; Call a function and pass arguments: Call("DownloadFromLink", "https://www.malwarebytes.com/mwb-download/thankyou/", "MBSetup.exe", 1, 1) Func DownloadFromLink($sUrl, $sFilename, $i1, $i2) ; Try to download from the URL & store the return handler in $hDownload. Local $hDownload = InetGet($sUrl, $sFilename, $i1, $i2) ; >>>>>>>>>>>>> NOT MY CODE FROM HERE & LOWER <<<<<<<<<<<<<<<<<<<<< ; Determine whether there were errors with the download: Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) ; Retrieve details about the download file. Local $aData = InetGetInfo($hDownload) MsgBox($MB_SYSTEMMODAL, "", "Bytes read: " & $aData[$INET_DOWNLOADREAD] & @CRLF & _ "Size: " & $aData[$INET_DOWNLOADSIZE] & @CRLF & _ "Complete: " & $aData[$INET_DOWNLOADCOMPLETE] & @CRLF & _ "successful: " & $aData[$INET_DOWNLOADSUCCESS] & @CRLF & _ "@error: " & $aData[$INET_DOWNLOADERROR] & @CRLF & _ "@extended: " & $aData[$INET_DOWNLOADEXTENDED] & @CRLF) Return False ; If an error occurred then return from the function ; Close the handle returned by InetGet. InetClose($hDownload) EndFunc ;===>DownloadFromLink Credit for Borrowed Code: https://www.autoitscript.com/autoit3/docs/functions/InetGetInfo.htm Code Result: (Note: The zip file is the program when I downloaded it myself manually. It is 2,000+ KB normally. The MBSetup.exe is the one the script downloaded.) What am I doing wrong? I've checked the documentation, I've tried searching it on Google, I'm at a loss. Help would be greatly appreciated, thank you!
×
×
  • Create New...