Download abbrechen ~

  • Hey Leute ;)

    Brauche mal wieder Hilfe ^^

    Also was ich diesmal gemacht hab:
    Ein GUI welches verschiedene Files anzeigt die gedownloaded werden können.
    Wenn man eins davon downloaden möchte (oder alle), dann erscheint ein kleines GUI mit 2 ProgressBars (eins davon ist noch nicht intakt, spielt aber grad keine Rolle) und zeigt den Status des Downloads an.

    Leider kann ich dieses kleine popup nicht beenden.

    Habe es dann noch auf GUISetOnEvent gestellt, was aber nichts brachte.

    Vllt wisst ihr eine gute Lösung für das Problem.

    Und hier der Script:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <IE.au3>
    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode",1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $selectedSkin = ""
    Global $skinList = ""
    Global $xfiredir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Xfire","")
    Global $selectSkin = " --- Select A Skin ----"

    [/autoit] [autoit][/autoit] [autoit]

    Dim $SkinDetail[10], $DownloadList[1]
    Dim $SkinDetailNames[2][10] = [["Fullname","Author","Version","FriendList","ServerBrowser","FileBrowser","IngameChat","GroupChat","VoiceChat","GameLobbies"], _
    ["Fullname:","Author/s:","Version:","Friends List:","Server Browser:","File Browser:","Ingame Chat:","Group Chat:","Voice Chat:","Game Lobbies:"]]

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $oIE = _IECreateEmbedded ()

    [/autoit] [autoit][/autoit] [autoit]

    ;############################################################
    ;# #
    ;# Main GUI #
    ;# #
    ;############################################################

    [/autoit] [autoit][/autoit] [autoit]

    $GUI = GUICreate("XSkin - Download Center",600,350)
    $GUIActiveX = GUICtrlCreateObj($oIE, 10, 20, 330, 320)
    $GUICombo = GUICtrlCreateCombo("",360,20,230)
    $GUIButtonDownloadAll = GUICtrlCreateButton("Download All",400,320,80)
    $GUIButtonDownloadSelected = GUICtrlCreateButton("Download Selected",490,320,105)
    GUICtrlSetState($GUIButtonDownloadSelected,$GUI_DISABLE)

    [/autoit] [autoit][/autoit] [autoit]

    ;- Creating Labels with names
    For $i = 0 To 2
    GUICtrlCreateLabel($SkinDetailNames[1][$i],360,70+$i*20,80,-1,$SS_RIGHT)
    Next
    For $i = 3 To UBound($SkinDetail)-1
    GUICtrlCreateLabel($SkinDetailNames[1][$i],360,90+$i*20,80,-1,$SS_RIGHT)
    Next
    ;- Creating Labels for the Data
    For $i = 0 To 2
    $SkinDetail[$i] = GUICtrlCreateLabel("",450,70+$i*20,140)
    Next
    For $i = 3 To UBound($SkinDetail)-1
    $SkinDetail[$i] = GUICtrlCreateLabel("",450,90+$i*20,140)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    _IENavigate ($oIE,"about:blank")
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    ;############################################################
    ;# #
    ;# Download GUI #
    ;# #
    ;############################################################

    [/autoit] [autoit][/autoit] [autoit]

    $progressGui = GUICreate("Downloading",220,120,-1,-1,BitOr($WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX), $WS_EX_TOOLWINDOW, $GUI)
    $progressDownloading = GUICtrlCreateLabel("Downloading:",10,70,200)
    $progressSpeed = GUICtrlCreateLabel("0/0 KBytes",10,95,130)
    $progressCurrent = GUICtrlCreateProgress(10,10,200,24)
    $progressTotal = GUICtrlCreateProgress(10,40,200,24)
    $progressAbort = GUICtrlCreateButton("Abort",150,90,60)
    ;GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    ;############################################################
    ;# #
    ;# ComboBox #
    ;# #
    ;############################################################
    $skinInfos = IniReadSectionNames("SkinLoader.ini")
    _ArrayDelete($skinInfos,0)
    For $i = 0 To UBound($skinInfos)-1
    $skinList &= "|" & $skinInfos[$i]
    Next
    GUICtrlSetData($GUICombo,$selectSkin & $skinList,$selectSkin)

    [/autoit] [autoit][/autoit] [autoit]

    ;############
    ; On Events #
    ;############

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent($GUI_EVENT_CLOSE,"Close",$GUI)
    GUISetOnEvent($GUI_EVENT_CLOSE,"Close",$progressGUI)
    GUICtrlSetOnEvent($progressAbort,"Close")
    GUICtrlSetOnEvent($GUICombo,"Combo")
    GUICtrlSetOnEvent($GUIButtonDownloadAll,"Download")
    GUICtrlSetOnEvent($GUIButtonDownloadSelected,"Download")

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    #cs
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $progressAbort
    If BitAND(WinGetState("Downloading",""),2) = 0 Then
    Exit
    Else
    InetGet("abort")
    GUISetState(@SW_Hide,$progressGUI)
    GUISetState(@SW_ENABLE,$GUI)
    EndIf
    Case $GUICombo
    Local $comboSelected = GUICtrlRead($GUICombo)
    If NOT (($comboSelected = $selectedSkin) OR ($comboSelected = $selectSkin)) Then
    GUICtrlSetState($GUIButtonDownloadSelected,$GUI_ENABLE)
    $selectedSkin = GUICtrlRead($GUICombo)
    For $i = 0 To 2
    GUICtrlSetData($SkinDetail[$i],IniRead("SkinLoader.ini",$comboSelected,$SkinDetailNames[0][$i],""))
    Next
    For $i = 3 To UBound($SkinDetail)-1
    GUICtrlSetColor($SkinDetail[$i],0xFF0000)
    $DetailState = StringReplace(StringReplace(IniRead("SkinLoader.ini",$comboSelected,$SkinDetailNames[0][$i],""),"1","Yes"),"0","No")
    If $DetailState = "Yes" Then GUICtrlSetColor($SkinDetail[$i],0x00FF00)
    GUICtrlSetData($SkinDetail[$i],$DetailState)
    Next
    _IENavigate ($oIE,IniRead("SkinLoader.ini",$comboSelected,"Image",0))
    ElseIf NOT ($comboSelected = $selectedSkin) AND ($comboSelected = $selectSkin) Then
    For $i = 0 To UBound($SkinDetail)-1
    GUICtrlSetData($SkinDetail[$i],"")
    Next
    GUICtrlSetState($GUIButtonDownloadSelected,$GUI_DISABLE)
    _IENavigate ($oIE,"about:blank")
    EndIf
    Case $GUIButtonDownloadAll
    Download($skinInfos)
    Case $GUIButtonDownloadSelected
    $DownloadList[0] = GUICtrlRead($GUICombo)
    Download($DownloadList)
    EndSwitch
    #ce
    Sleep(10)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func Download()
    If @GUI_CTRLID = $GUIButtonDownloadAll Then
    $aFiles = $skinInfos
    Else
    Dim $aFiles[1] = [GUICtrlRead($GUICombo)]
    EndIf
    ;_ArrayDisplay($aFiles)
    GUISetState(@SW_DISABLE,$GUI)
    GUISetState(@SW_SHOW,$progressGUI)
    ;-- Starting Downloadprogress

    #region Old
    Local $totalsize = 0
    Local $site = "http://www.gunsammocrate.com"
    Dim $files[UBound($aFiles)]

    For $i=0 to Ubound($aFiles)-1
    $path = IniRead("SkinLoader.ini",$aFiles[$i],"Download",0)
    $name = StringSplit($path,"=")
    GUICtrlSetData($progressDownloading,"Downloading: " & $name[$name[0]])
    For $j = 0 To Ubound($aFiles)-1
    $files[$j] = InetGetSize($site & IniRead("SkinLoader.ini",$aFiles[$j],"Download",0))
    Next
    $size = InetGetSize($site & $path)
    InetGet($site & $path,$name[$name[0]],1,1)
    While @InetGetActive
    ;GUICtrlSetData($progressTotal,)
    GUICtrlSetData($progressCurrent,(@InetGetBytesRead/$size)*100)
    ;ToolTip(Round((($i/(Ubound($aFiles)-1)) + (1/(Ubound($aFiles)-1)) * (@InetGetBytesRead/$totalsize))*100,0))
    If NOT GUIGetMsg() = 0 Then ConsoleWrite(GUIGetMsg())
    WEnd
    ConsoleWrite("Downloaded: " & GUICtrlRead($progressCurrent) &@CRLF)
    ConsoleWrite($site & $path & @CRLF)
    ConsoleWrite($name[$name[0]] & @CRLF)
    Next
    Close()
    #endregion
    ;GUISetState(@SW_Hide,$progressGUI)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Close()
    ConsoleWrite("@GUI_CTRLID = " & @GUI_CTRLID & @CRLF)
    ConsoleWrite("Fenster ist offen: " & BitAND(WinGetState("Downloading",""),2) & @CRLF)
    If BitAND(WinGetState("Downloading",""),2) = 0 Then
    Exit
    Else
    InetGet("abort")
    GUISetState(@SW_Hide,$progressGUI)
    GUISetState(@SW_ENABLE,$GUI)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Combo()
    Local $comboSelected = GUICtrlRead($GUICombo)
    If NOT (($comboSelected = $selectedSkin) OR ($comboSelected = $selectSkin)) Then
    GUICtrlSetState($GUIButtonDownloadSelected,$GUI_ENABLE)
    $selectedSkin = GUICtrlRead($GUICombo)
    For $i = 0 To 2
    GUICtrlSetData($SkinDetail[$i],IniRead("SkinLoader.ini",$comboSelected,$SkinDetailNames[0][$i],""))
    Next
    For $i = 3 To UBound($SkinDetail)-1
    GUICtrlSetColor($SkinDetail[$i],0xFF0000)
    $DetailState = StringReplace(StringReplace(IniRead("SkinLoader.ini",$comboSelected,$SkinDetailNames[0][$i],""),"1","Yes"),"0","No")
    If $DetailState = "Yes" Then GUICtrlSetColor($SkinDetail[$i],0x00FF00)
    GUICtrlSetData($SkinDetail[$i],$DetailState)
    Next
    _IENavigate ($oIE,IniRead("SkinLoader.ini",$comboSelected,"Image",0))
    EndIf
    EndFunc

    [/autoit]

    Und die SkinLoader.ini:

    Spoiler anzeigen
    [autoit][/autoit] [autoit][/autoit] [autoit]

    [Onyx]
    Fullname=Onyx
    Author=Gunowar
    Version=1.0
    Image=http://www.gunsammocrate.com/images/XFS/Onyx.gif
    Download=/cgi-bin/downloader/dl.pl?id=Onyx.zip

    [/autoit] [autoit][/autoit] [autoit]

    FriendList=1
    ServerBrowser=1
    FileBrowser=1
    IngameChat=1
    GroupChat=1
    VoiceChat=1
    GameLobbies=1

    [/autoit] [autoit][/autoit] [autoit]

    [GuildWars]
    FullName=Guild Wars
    Author=Chrury
    Version=1.0
    Image=http://www.gunsammocrate.com/images/XFS/GuildWars.gif
    Download=/cgi-bin/downloader/dl.pl?id=GuildWars.zip

    [/autoit] [autoit][/autoit] [autoit]

    FriendList=1
    ServerBrowser=1
    FileBrowser=1
    IngameChat=1
    GroupChat=1
    VoiceChat=1
    GameLobbies=1

    [/autoit] [autoit][/autoit] [autoit]

    [WMP10]
    Fullname=Windows Media Player 10
    Author=FaNtA/Gunowar
    Version=1.0
    Image=http://www.gunsammocrate.com/images/XFS/WMP10.png
    Download=/cgi-bin/downloader/dl.pl?id=WMP10.zip

    [/autoit] [autoit][/autoit] [autoit]

    FriendList=1
    ServerBrowser=1
    FileBrowser=1
    IngameChat=1
    GroupChat=1
    VoiceChat=1
    GameLobbies=1

    [/autoit] [autoit][/autoit] [autoit]

    [Hypernia]
    Fullname=Hypernia
    Author=Jemlex Studios
    Version=1.0
    Image=http://www.gunsammocrate.com/images/XFS/Hypernia.gif
    Download=/cgi-bin/downloader/dl.pl?id=Hypernia.zip

    [/autoit] [autoit][/autoit] [autoit]

    FriendList=1
    ServerBrowser=1
    FileBrowser=1
    IngameChat=1
    GroupChat=0
    VoiceChat=0
    GameLobbies=0

    [/autoit]

    MfG,
    FaNtA

  • Na super..

    Hab ich mal wieder ein Problem bei dem keiner helfen kann(/will :P)

    :(

    Einmal editiert, zuletzt von XxXFaNtA (28. Oktober 2007 um 13:53)