Hab bei Zippyshare eine Datei hochgeladen und den Link eingefügt z.b http://www56.zippyshare.com/d/59742818%20Setup.exe (Link ist nur ein Beispiel) hier noch mein Script:
Spoiler anzeigen
#include-once
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <InetConstants.au3>
#include <StaticConstants.au3>
#include <WinAPIMisc.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
Func _DownloadWithProgress($sURL, $sDownloadDir = @ScriptDir, $sTitle = 'Downloader', $iLeft = -1, $iTop = -1, $hParent = 0)
If $sURL = '' Then Return SetError(1, 0, 0)
If Not FileExists($sDownloadDir) Then Return SetError(2, 0, 0)
_GDIPlus_Startup()
Global Const $aDPI = _GDIPlus_GraphicsGetDPIRatio()
If StringRight($sDownloadDir, 1) <> '\' Then $sDownloadDir &= '\'
HttpSetUserAgent('Downloader')
Local $iOldEventMode = Opt('GUIOnEventMode', 0)
If Not $hParent Then TraySetState(2) ; TrayIcon verstecken, wenn kein Parent angegeben wurde
Local $iDownloadSize = 0, $aDownloadData, $iTimer = TimerInit(), $iError = 0, $iPercent = 0, $hDownload
Local $iDownSpeedTimer = TimerInit(), $iDownSpeed = 0, $iRestTime = 0, $iOldTime = 0
Local $hGui = GUICreate($sTitle, 400, 240, $iLeft, $iTop, -1, -1, $hParent)
GUISetIcon('Icon.ico', $hGui)
GUISetFont(10, 400, 0, 'Arial', $hGui, 5)
GUISetBkColor(0x000000, $hGui) ;Schwarz Hintergrund
GUICtrlCreateGroup('', 10, 5, 380, 165)
GUICtrlCreateLabel(StringFormat('Datei: "%s"', StringRegExpReplace($sURL, '.+\/(.+)', '$1')), 25, 22, 350, 20)
GUICtrlSetFont(-1, 12, 400, 0, 'Arial', 5)
GUICtrlSetColor(-1, 0xFFFFFF) ;Rot Dateiname
Local $idDownloadSize = GUICtrlCreateLabel('Dateigröße:', 25, 50, 350, 16)
GUICtrlSetColor(-1, 0xFFFF00) ;Gelb Dateigröße
Local $idDownloadSpeed = GUICtrlCreateLabel('Geschwindigkeit:', 25, 70, 350, 16)
GUICtrlSetColor(-1, 0xFFFF00) ;Gelb Geschwindigkeit
Local $idDownloadTime = GUICtrlCreateLabel('Downloadzeit:', 25, 90, 350, 16)
GUICtrlSetColor(-1, 0xFFFF00) ;Gelb Downloadzeit
Local $idRestTime = GUICtrlCreateLabel('Restzeit (geschätzt):', 25, 110, 350, 16)
GUICtrlSetColor(-1, 0xFFFF00) ;Gelb Restzeit
Local $iW = 360, $iH = 24, $iBGColor = 0x1E1E1E, $hHBmp_BG, $hB, $iSleep ;Prozessbar Hintergrund
Local $idProgress = GUICtrlCreatePic("", 20, 138, $iW, $iH)
Local $aColors[7][2] = [[0xFFEE5F5B, 0xFFF07673],[0xFFABCC04, 0xFFBBD636],[0xFF78CCEE, 0xFF93D6F1],[0xFFFFBB58, 0xFFFFC97A],[0xFFFF6677, 0xFFFF8795],[0xFF78CCEE, 0xFFFFC97A],[0xFF78CCEE, 0xFFE8E5D9]]
$hHBmp_BG = _GDIPlus_StripProgressbar($iPercent, $iW, $iH, 0xFF000000 + $iBGColor, $aColors[1][0], $aColors[1][1], '')
$hB = GUICtrlSendMsg($idProgress, 0x0172, $IMAGE_BITMAP, $hHBmp_BG)
If $hB Then _WinAPI_DeleteObject($hB)
_WinAPI_DeleteObject($hHBmp_BG)
GUICtrlCreateGroup('', -99, -99, 1, 1)
Local $idCancelButton = GUICtrlCreateButton('Download abbrechen', 120, 180, 140, 25)
Local $hStatus = _GUICtrlStatusBar_Create($hGui)
Local $hAttentionIcon = _WinAPI_LoadShell32Icon(77)
Local $hOkIcon = _WinAPI_LoadShell32Icon(144)
Local $hInfoIcon = _WinAPI_LoadShell32Icon(277)
_GUICtrlStatusBar_SetIcon($hStatus, 0, $hInfoIcon)
_GUICtrlStatusBar_SetText($hStatus, 'Dateigröße wird ermittelt! Bitte warten...')
GUISetState(@SW_SHOW, $hGui)
Local $iDriveSpaceFree = DriveSpaceFree($sDownloadDir) * 2 ^ 20 ; in Bytes umrechnen
Local $iFileSize = InetGetSize($sURL) ; wird in Bytes ausgegeben
If Not @error Then
If $iDriveSpaceFree > $iFileSize Then
_GUICtrlStatusBar_SetText($hStatus, 'Datei wird heruntergeladen...')
$iDownSpeedTimer = TimerInit()
GUICtrlSetData($idDownloadSize, StringFormat('Dateigröße: %s / %s', _WinAPI_StrFormatByteSize($iDownloadSize), _WinAPI_StrFormatByteSize($iFileSize)))
GUICtrlSetData($idDownloadSpeed, StringFormat('Geschwindigkeit: %s/s', $iDownSpeed))
$hDownload = InetGet($sURL, $sDownloadDir & StringRegExpReplace($sURL, '.+\/(.+)', '$1'), 1, 1)
$iSleep = TimerInit()
Do
Switch GUIGetMsg()
Case $idCancelButton
$iError = 3
ExitLoop
Case $GUI_EVENT_CLOSE
_WinAPI_DestroyIcon($hAttentionIcon)
_WinAPI_DestroyIcon($hOkIcon)
_WinAPI_DestroyIcon($hInfoIcon)
InetClose($hDownload)
HttpSetUserAgent('')
Opt('GUIOnEventMode', $iOldEventMode)
GUIDelete($hGui)
Return SetError(3, 0, 0)
EndSwitch
$aDownloadData = InetGetInfo($hDownload)
If $aDownloadData[$INET_DOWNLOADERROR] Then
$iError = 4
ExitLoop
EndIf
$iDownloadSize = $aDownloadData[$INET_DOWNLOADREAD]
If TimerDiff($iTimer) > 250 Then
$iDownSpeed = _WinAPI_StrFormatByteSize($iDownloadSize / TimerDiff($iDownSpeedTimer) * 1000)
$iTimer = TimerInit()
$iPercent = Int(100 / $iFileSize * $iDownloadSize)
GUICtrlSetData($idDownloadSize, StringFormat('Dateigröße:\t\t%s / %s', _WinAPI_StrFormatByteSize($iDownloadSize), _WinAPI_StrFormatByteSize($iFileSize)))
GUICtrlSetData($idDownloadSpeed, StringFormat('Geschwindigkeit:\t%s/s', $iDownSpeed))
GUICtrlSetData($idDownloadTime, StringFormat('Downloadzeit:\t\t%s', _WinAPI_StrFromTimeInterval(TimerDiff($iDownSpeedTimer))))
$iRestTime = ($iFileSize - $iDownloadSize) / ($iDownloadSize / TimerDiff($iDownSpeedTimer))
If $iRestTime <> $iOldTime Then
$iOldTime = $iRestTime
GUICtrlSetData($idRestTime, StringFormat('Restzeit (geschätzt):\t%s', _WinAPI_StrFromTimeInterval($iRestTime)))
EndIf
EndIf
If TimerDiff($iSleep) > 50 Then
$hHBmp_BG = _GDIPlus_StripProgressbar($iPercent, $iW, $iH, 0xFF000000 + $iBGColor, $aColors[1][0], $aColors[1][1], $iPercent & '%')
$hB = GUICtrlSendMsg($idProgress, 0x0172, $IMAGE_BITMAP, $hHBmp_BG)
If $hB Then _WinAPI_DeleteObject($hB)
_WinAPI_DeleteObject($hHBmp_BG)
$iSleep = TimerInit()
EndIf
Until $aDownloadData[$INET_DOWNLOADCOMPLETE]
If $iError Then
$hHBmp_BG = _GDIPlus_StripProgressbar($iPercent, $iW, $iH, 0xFF000000 + $iBGColor, $aColors[0][0], $aColors[0][1], $iPercent & '%')
$hB = GUICtrlSendMsg($idProgress, 0x0172, $IMAGE_BITMAP, $hHBmp_BG)
If $hB Then _WinAPI_DeleteObject($hB)
_WinAPI_DeleteObject($hHBmp_BG)
_GUICtrlStatusBar_SetIcon($hStatus, 0, $hAttentionIcon)
_GUICtrlStatusBar_SetText($hStatus, 'Download abgebrochen!')
Else
GUICtrlSetData($idDownloadSize, StringFormat('Dateigröße:\t\t%s / %s', _WinAPI_StrFormatByteSize($iDownloadSize), _WinAPI_StrFormatByteSize($iFileSize)))
GUICtrlSetData($idDownloadSpeed, StringFormat('Geschwindigkeit:\t%s/s', $iDownSpeed))
_GUICtrlStatusBar_SetIcon($hStatus, 0, $hOkIcon)
_GUICtrlStatusBar_SetText($hStatus, 'Download abgeschlossen!')
$hHBmp_BG = _GDIPlus_StripProgressbar(100, $iW, $iH, 0xFF000000 + $iBGColor, $aColors[1][0], $aColors[1][1], '100%')
$hB = GUICtrlSendMsg($idProgress, 0x0172, $IMAGE_BITMAP, $hHBmp_BG)
If $hB Then _WinAPI_DeleteObject($hB)
_WinAPI_DeleteObject($hHBmp_BG)
EndIf
InetClose($hDownload)
Else
$iError = 5
_GUICtrlStatusBar_SetIcon($hStatus, 0, $hAttentionIcon)
_GUICtrlStatusBar_SetText($hStatus, 'Fehler! Nicht genug Platz auf dem Datenträger!')
EndIf
Else
$iError = 6
_GUICtrlStatusBar_SetIcon($hStatus, 0, $hAttentionIcon)
_GUICtrlStatusBar_SetText($hStatus, 'Fehler! Dateigröße konnte nicht ermittelt werden!')
EndIf
GUICtrlSetData($idCancelButton, 'Fenster schließen')
While True
Switch GUIGetMsg()
Case $idCancelButton, $GUI_EVENT_CLOSE
_WinAPI_DestroyIcon($hAttentionIcon)
_WinAPI_DestroyIcon($hOkIcon)
_WinAPI_DestroyIcon($hInfoIcon)
HttpSetUserAgent('')
Opt('GUIOnEventMode', $iOldEventMode)
GUIDelete($hGui)
_GDIPlus_Shutdown()
Return SetError($iError, 0, 0)
EndSwitch
WEnd
EndFunc ;==>_DownloadWithProgress
Func _GDIPlus_StripProgressbar($fPerc, $iW, $iH, $iBgColorGui = 0xFFF0F0F0, $iFgColor = 0xFFEE5F5B, $iBGColor = 0xFFF07673, $sText = "Loading...", $iTextColor = 0xFF0000, $iDir = -1, $iSpeed = 1, $sFont = "Arial", $bFlip = False, $bHBitmap = True)
$fPerc = $fPerc < 0 ? 0 : $fPerc
$fPerc = $fPerc > 100 ? 100 : $fPerc
Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
Local Const $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetPixelOffsetMode($hCtxt, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)
_GDIPlus_GraphicsClear($hCtxt, $iBgColorGui)
Local $iWidth = $iH * 2, $iLen = $iWidth / 2, $iY
Local $hBmp = _GDIPlus_BitmapCreateFromScan0($iWidth, $iH)
Local Const $hCtxt_Bmp = _GDIPlus_ImageGetGraphicsContext($hBmp)
_GDIPlus_GraphicsSetPixelOffsetMode($hCtxt_Bmp, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)
Local $hPen = _GDIPlus_PenCreate($iFgColor), $iPenSize = Int($iH / 12)
Local $hPen2 = _GDIPlus_PenCreate(0x50000000, $iPenSize)
_GDIPlus_GraphicsClear($hCtxt_Bmp, $iBGColor)
Local Static $iX = 0
For $iY = 0 To $iH - 1
Switch $iDir
Case 1
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, $iX + $iY, $iY, $iX + $iY + $iLen, $iY, $hPen)
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, $iX + $iY - 2 * $iLen, $iY, $iX + $iY - 1 * $iLen, $iY, $hPen)
Case Else
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, -$iX + $iY, $iY, -$iX + $iY + $iLen, $iY, $hPen)
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, -$iX + $iY + 2 * $iLen, $iY, -$iX + $iY + 3 * $iLen, $iY, $hPen)
EndSwitch
Next
Local $tPoint1 = DllStructCreate("float;float")
Local $tPoint2 = DllStructCreate("float;float")
DllStructSetData($tPoint1, 1, $iW / 2) ;x1
DllStructSetData($tPoint2, 1, $iW / 2) ;x2
Local $hLineBrush
If $bFlip Then
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, 0, 0, $iWidth, 0, $hPen2)
DllStructSetData($tPoint1, 2, $iH / 3) ;y1
DllStructSetData($tPoint2, 2, $iH * 2 / 3) ;y2
$hLineBrush = DllCall($__g_hGDIPDll, "uint", "GdipCreateLineBrush", "struct*", $tPoint1, "struct*", $tPoint2, "uint", 0x00FFFFFF, "uint", 0xB0FFFFFF, "int", 0, "int*", 0)
$hLineBrush = $hLineBrush[6]
_GDIPlus_GraphicsFillRect($hCtxt_Bmp, 0, $iH * 2 / 3 + 1, $iW, $iH / 3, $hLineBrush)
Else
_GDIPlus_GraphicsDrawLine($hCtxt_Bmp, 0, $iH - $iPenSize / 2, $iWidth, $iH - $iPenSize / 2, $hPen2)
DllStructSetData($tPoint1, 2, 0) ;y1
DllStructSetData($tPoint2, 2, $iH / 3) ;y2
$hLineBrush = DllCall($__g_hGDIPDll, "uint", "GdipCreateLineBrush", "struct*", $tPoint1, "struct*", $tPoint2, "uint", 0xB0FFFFFF, "uint", 0x00FFFFFF, "int", 0, "int*", 0)
$hLineBrush = $hLineBrush[6]
_GDIPlus_GraphicsFillRect($hCtxt_Bmp, 0, 0, $iW, $iH / 3, $hLineBrush)
EndIf
$iX = Mod($iX + $iSpeed, $iWidth)
Local $hTextureBrush = _GDIPlus_TextureCreate($hBmp)
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $fPerc / 100 * $iW, $iH, $hTextureBrush)
If $bFlip Then _GDIPlus_ImageRotateFlip($hBitmap, 6)
_GDIPlus_GraphicsSetTextRenderingHint($hCtxt, 4)
Local $hBrush = _GDIPlus_BrushCreateSolid(0xE0000000 + $iTextColor)
Local $hFormat = _GDIPlus_StringFormatCreate()
Local $hFamily = _GDIPlus_FontFamilyCreate($sFont)
Local $hFont = _GDIPlus_FontCreate($hFamily, $iH * 3 / 7)
Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH)
_GDIPlus_StringFormatSetAlign($hFormat, 1)
_GDIPlus_StringFormatSetLineAlign($hFormat, 1)
_GDIPlus_GraphicsDrawStringEx($hCtxt, $sText, $hFont, $tLayout, $hFormat, $hBrush)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPen2)
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_GraphicsDispose($hCtxt_Bmp)
_GDIPlus_BitmapDispose($hBmp)
_GDIPlus_BrushDispose($hTextureBrush)
_GDIPlus_BrushDispose($hLineBrush)
If $bHBitmap Then
Local $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_GDIPlus_BitmapDispose($hBitmap)
Return $hHBITMAP
EndIf
Return $hBitmap
EndFunc ;==>_GDIPlus_StripProgressbar
Func _GDIPlus_GraphicsGetDPIRatio($iDPIDef = 96)
Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0)
If @error Then Return SetError(1, @extended, 0)
Local $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0)
If @error Then Return SetError(2, @extended, 0)
Local $iDPI = $aResult[2]
_GDIPlus_GraphicsDispose($hGfx)
Local $aResults[2] = [$iDPIDef / $iDPI, $iDPI / $iDPIDef]
Return $aResults
EndFunc ;==>_GDIPlus_GraphicsGetDPIRatio