#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("File Downloader v1.0", 349, 238, 192, 124)
$Input1 = GUICtrlCreateInput("", 24, 48, 289, 21)
$Button1 = GUICtrlCreateButton("Download", 96, 88, 121, 73, $WS_GROUP)
$Progress1 = GUICtrlCreateProgress(24, 184, 289, 25)
GUICtrlSetBkColor(-1, 0xD4D0C8)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button1
			_FileDownload()
	EndSwitch
WEnd


Func _FileDownload()
	Local $url, $FSDUrl, $i, $size = InetGetSize($url)
	$url = GUICtrlRead($Input1)

	$FSDUrl = FileSaveDialog("Speichern", @DesktopDir, "Alle Dateien(*.*)")

	InetGet($url, $FSDUrl, 1, 1)


	While @InetGetActive
		GUICtrlSetData($Progress1, $i)
		Sleep(50)
		$i = $i + 2
		If @InetGetBytesRead >= $size Then
			GUICtrlSetData($Progress1, 100)
		EndIf
	WEnd
EndFunc
