Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

{Req} Download a file 3 server?

$
0
0
plz help for fix code :
3 server file download.

#NoTrayIcon
#RequireAdmin
Server1() ; Download a file in the background.
Server2() ; Wait for the Download to complete.
Server3() ; Wait for the Download to complete.

Func Server1()
	; Save the downloaded file to the temporary folder.
	Local $sFilePath = @SystemDir & "\text1.exe"

	; Download the file in the background with the selected option of 'force a reload from the remote site.'
	Local $hDownload = InetGet("http://www.test1.com/text.exe", @SystemDir & "\text.exe", 1, 1)

	; Wait for the Download to complete by monitoring when the 2nd index value of InetGetInfo returns True.
	Do
		Sleep(250)
	Until InetGetInfo($hDownload, 2)
	Local $aData = InetGetInfo($hDownload) ; Get all information.

	; Retrieve the number of total bytes received and the filesize.
	Local $iBytesSize = InetGetInfo($hDownload, 0)
	Local $iFileSize = FileGetSize($sFilePath)


	; Close the handle returned by InetGet.
	InetClose($hDownload)

	; Display details about the total number of bytes read and the filesize.
  MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _
		"Size: " & $aData[1] & @CRLF & _
		"Complete?: " & $aData[2] & @CRLF & _
		"Successful?: " & $aData[3] & @CRLF & _
		"@error: " & $aData[4] & @CRLF & _
		"@extended: " & $aData[5] & @CRLF)

ShellExecute("regedit.exe", '/s "' & @SystemDir & '\text.exe"')
Sleep(250)
; Delete the file.
FileDelete(@SystemDir & "\text.exe")

 EndFunc   ;==>Server1

Func Server2()
	; Save the downloaded file to the temporary folder.
	Local $sFilePath = @SystemDir & "\text.exe"

	; Download the file by waiting for it to complete. The option of 'get the file from the local cache' has been selected.
	Local $iBytesSize = InetGet("http://www.test2.com/text.exe", @SystemDir & "\text.exe", 1)


	; Retrieve the filesize.
	Local $iFileSize = FileGetSize($sFilePath)

	; Display details about the total number of bytes read and the filesize.
  MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _"Size: " & $aData[1] & @CRLF & _"Complete?: " & $aData[2] & @CRLF & _"Successful?: " & $aData[3] & @CRLF & _"@error: " & $aData[4] & @CRLF & _		"@extended: " & $aData[5] & @CRLF)

ShellExecute("regedit.exe", '/s "' & @SystemDir & '\text.exe"')
Sleep(250)
; Delete the file.
FileDelete(@SystemDir & "\text.exe")
EndFunc   ;==>Server2

Func Server3()
	; Save the downloaded file to the temporary folder.
	Local $sFilePath = @SystemDir & "\text.exe"

	; Download the file by waiting for it to complete. The option of 'get the file from the local cache' has been selected.
	Local $iBytesSize = InetGet("http://www.test3.com/text.exe", @SystemDir & "\text.exe", 1)


	; Retrieve the filesize.
	Local $iFileSize = FileGetSize($sFilePath)

	; Display details about the total number of bytes read and the filesize.
   MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _
		"Size: " & $aData[1] & @CRLF & _
		"Complete?: " & $aData[2] & @CRLF & _
		"Successful?: " & $aData[3] & @CRLF & _
		"@error: " & $aData[4] & @CRLF & _
		"@extended: " & $aData[5] & @CRLF)

ShellExecute("regedit.exe", '/s "' & @SystemDir & '\text.exe"')
Sleep(250)
; Delete the file.
FileDelete(@SystemDir & "\text.exe")
EndFunc   ;==>Server3


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>