Script Stürzt ab.

  • Hallo zusammen,
    ich habe ein Problem mit meinem Script.
    Immer wenn ich auf den 'Weiter' Butten drücke stürzt es ab (._.)
    Ich weiß einfach nicht warum, ich hoffe Ihr könnt mir helfen.

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <WinAPI.au3>
    #include <GDIPlus.au3>
    #include <File.au3>
    #include <Array.au3>
    #include <RecFileListToArray.au3>
    #NoTrayIcon
    #RequireAdmin
    #include-once

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

    FileInstall("header.JPG",@tempdir&"\header.JPG")
    FileInstall('ag.ico', @TempDir & '\ag.ico')

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

    Opt("GUIOnEventMode", 1)
    #Region ### START Koda GUI section ### Form=c:\users\delux\desktop\form1.kxf
    $Form1_1 = GUICreate("PC-Bereinigung.", 645, 442)
    GUISetBkColor(0xFFFFFF)
    GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
    $Pic1 = GUICtrlCreatePic(@tempdir&"\header.JPG", 0, 0,645, 100)
    $idPB_AddTicket = GUICtrlCreatePic('', 8, 16, 64, 64)
    __SetIconAlpha($idPB_AddTicket, @TempDir & '\ag.ico', 0, 64, 64)
    $Label1 = GUICtrlCreateLabel("PC-Bereinigung", 80, 34, 237, 30)
    GUICtrlSetFont(-1, 12, 800, 0, "Tahoma")
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Label2 = GUICtrlCreateLabel("Verbessern Sie die Leistung ihres Computers.", 80, 56, 299, 22)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Group1 = GUICtrlCreateGroup("", 8, 104, 631, 329)
    $Label3 = GUICtrlCreateLabel("Wichtiger Hinweis", 16, 120, 119, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    $Label4 = GUICtrlCreateLabel("Durch die Bereinigung wird die Leistung Ihres Computers verbessert, indem Objekte entfernt werden, die", 16, 144, 605, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $Label10 = GUICtrlCreateLabel("nicht mehr gebraucht werden, z.B. temporäre Internetdateien und Cookies. Es werden keine aktuellen", 16, 160, 587, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $Button1 = GUICtrlCreateButton("Weiter", 501, 392, 131, 33)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    GUICtrlSetOnEvent(-1,"_CleanUpAll")
    $Button2 = GUICtrlCreateButton("Abbrechen", 15, 392, 131, 33)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    GUICtrlSetOnEvent(-1,"_Exit")
    $Label5 = GUICtrlCreateLabel("Dateien gelöscht.", 16, 176, 102, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $Label6 = GUICtrlCreateLabel("Folgende Browser werden bereinigt", 16, 208, 234, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    $Label7 = GUICtrlCreateLabel("• Mozilla-Firefox", 16, 232, 97, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $Label8 = GUICtrlCreateLabel("• Internet-Explorer", 16, 256, 111, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $Label9 = GUICtrlCreateLabel("• Google-Chrome", 16, 280, 102, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $Label11 = GUICtrlCreateLabel("Klicken Sie auf 'Weiter' um den Vorgang zu starten.", 16, 368, 318, 20)
    GUICtrlSetFont(-1, 10, 400, 4, "Tahoma")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    $2Form1_1 = GUICreate("PC-Bereinigung.", 645, 442)
    GUISetBkColor(0xFFFFFF)
    GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit")
    $Pic21 = GUICtrlCreatePic(@TempDir & '\header.JPG', 0, 0,645, 100)
    $idPB_AddTicket2 = GUICtrlCreatePic('', 8, 16, 64, 64)
    __SetIconAlpha($idPB_AddTicket2, @TempDir & '\ag.ico', 0, 64, 64)
    $2Label1 = GUICtrlCreateLabel("PC-Bereinigung", 80, 34, 237, 30)
    GUICtrlSetFont(-1, 12, 800, 0, "Tahoma")
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $2Label2 = GUICtrlCreateLabel("Verbessern Sie die Leistung ihres Computers.", 80, 56, 299, 22)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $2Group1 = GUICtrlCreateGroup("", 8, 104, 631, 329)
    $2Label3 = GUICtrlCreateLabel("Wichtiger Hinweis", 16, 120, 119, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    $2Label4 = GUICtrlCreateLabel("Durch die Bereinigung wird die Leistung Ihres Computers verbessert, indem Objekte entfernt werden, die", 16, 144, 605, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $2Label10 = GUICtrlCreateLabel("nicht mehr gebraucht werden, z.B. temporäre Internetdateien und Cookies. Es werden keine aktuellen", 16, 160, 587, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $2Button1 = GUICtrlCreateButton("Weiter", 501, 392, 131, 33)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    GUICtrlSetState(-1,$GUI_DISABLE)
    GUICtrlSetOnEvent(-1,"_Exit")
    $2Button2 = GUICtrlCreateButton("Abbrechen", 15, 392, 131, 33)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    GUICtrlSetOnEvent(-1,"_Exit")
    $2Label5 = GUICtrlCreateLabel("Dateien gelöscht.", 16, 176, 102, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $2Label6 = GUICtrlCreateLabel("Status", 16, 208, 47, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    $2Label9 = GUICtrlCreateLabel("Cookies und temporäre Internetdateien werden entfernt...", 16, 232, 336, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    $2Label11 = GUICtrlCreateLabel("Klicken Sie auf 'Weiter' um den Vorgang abzuschließen.", 16, 368, 322, 20)
    GUICtrlSetFont(-1, 10, 400, 4, "Tahoma")
    $2Progress1 = GUICtrlCreateProgress(16, 248, 614, 29)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_HIDE)

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

    While 1
    Sleep(100)
    WEnd

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

    Func _Exit()
    Exit
    EndFunc

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

    Func _CleanUpAll()
    GUISetState(@SW_SHOW,$2Form1_1)
    GUISetState(@SW_HIDE,$Form1_1)
    GUICtrlSetData($2Progress1,5)
    clean_profiles()
    GUICtrlSetData($2Progress1,100)
    GUICtrlSetState($2Button1,$GUI_DISABLE)
    EndFunc

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

    func clean_profiles()

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

    $userdir = StringTrimRight( @userprofiledir , stringlen (@username) +1 ) ; $userdir = path of users directories. For example, C:\Users for Windows 7
    $listing = _FileListToArray($userdir, "*", 2) ;returns an array containing the name of all users directories

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

    $i = 1

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

    Do
    if stringinstr(FileGetAttrib($userdir & "\" & $listing[$i]), "H") <> 0 then ;if the folder has "hidden" as attribute (system user), we remove it from $listing array
    _arraydelete($listing, $i)
    $listing[0] = $listing[0] - 1

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

    Else
    $i = $i+1
    endif

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

    until $listing[0] == $i

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

    for $i = 1 to $listing[0] step 1 ; for all user directories, we clean the below folders:

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

    if @OSVersion == "WIN_7" then

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

    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Microsoft\Windows\Temporary Internet Files")
    GUICtrlSetData($2Progress1,10)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Temp")
    GUICtrlSetData($2Progress1,20)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\LocalLow\Temp")
    GUICtrlSetData($2Progress1,30)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Google\Chrome\User Data\Default\Cache")
    GUICtrlSetData($2Progress1,40)

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

    $firefox = _FileListToArray(@Homedrive & "\Users\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles", "*", 2)

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

    if IsArray($firefox) then ; if at least 1 firefox profile is found, we clean it/them

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

    for $k = 1 to $firefox[0] step 1

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

    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\Cache")
    GUICtrlSetData($2Progress1,50)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\OfflineCache")
    GUICtrlSetData($2Progress1,60)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\startupCache")
    GUICtrlSetData($2Progress1,70)

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

    next

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

    endif

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

    elseif @OSVersion == "WIN_XP" Then

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

    delfolder($userdir & "\" & $listing[$i] & "\Local Settings\Temporary Internet Files")
    GUICtrlSetData($2Progress1,10)
    delfolder($userdir & "\" & $listing[$i] & "\Local Settings\Temp")
    GUICtrlSetData($2Progress1,20)
    delfolder($userdir & "\" & $listing[$i] & "\Local Settings\Application Data\Google\Chrome\User Data\Default\Cache")
    GUICtrlSetData($2Progress1,30)

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

    $firefox = _FileListToArray(@Homedrive & "\Users\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles", "*", 2)

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

    if IsArray($firefox) then ; if at least 1 firefox profile is found, we clean it/them

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

    for $k = 1 to $firefox[0] step 1

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

    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\Cache")
    GUICtrlSetData($2Progress1,40)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\OfflineCache")
    GUICtrlSetData($2Progress1,50)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\startupCache")
    GUICtrlSetData($2Progress1,60)

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

    next

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

    endif

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

    endif

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

    next

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

    EndFunc

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

    func delfolder ($folder)

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

    $dirlisting = _RecFileListToArray($folder, "*", 14, 1) ;getting all folders/subfolders into an array

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

    if isArray($dirlisting) then ;if the folder contains subfolder, we delete everything inside each subfolders

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

    filedelete($folder & "\*.*")

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

    for $i = 1 to $dirlisting[0] step 1

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

    filedelete($folder & "\" & $dirlisting[$i] & "\*.*")
    Dirremove($folder & "\" & $dirlisting[$i], 1)
    next

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

    else ;if the folder doesn't contains subfolder, we simply delete what's inside it.

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

    filedelete($folder & "\*.*")

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

    endif

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

    endfunc

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

    Func __SetIconAlpha($hWnd, $sIcon, $iIndex, $iWidth, $iHeight)
    If Not IsHWnd($hWnd) Then
    $hWnd = GUICtrlGetHandle($hWnd)
    If $hWnd = 0 Then
    Return SetError(1, 0, 0)
    EndIf
    EndIf
    Local $hIcon = __WinAPI_ShellExtractIcons($sIcon, $iIndex, $iWidth, $iHeight)
    If $hIcon = 0 Then
    Return SetError(1, 0, 0)
    EndIf
    Local $hBitmap, $hObj, $hDC, $hMem, $hSv
    $hDC = _WinAPI_GetDC($hWnd)
    $hMem = _WinAPI_CreateCompatibleDC($hDC)
    $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
    $hSv = _WinAPI_SelectObject($hMem, $hBitmap)
    _WinAPI_DrawIconEx($hMem, 0, 0, $hIcon, $iWidth, $iHeight, 0, 0, 2)
    _WinAPI_ReleaseDC($hWnd, $hDC)
    _WinAPI_SelectObject($hMem, $hSv)
    _WinAPI_DeleteDC($hMem)
    _WinAPI_DestroyIcon($hIcon)
    _WinAPI_DeleteObject(_SendMessage($hWnd, 0x0172, 0, 0))
    _SendMessage($hWnd, 0x0172, 0, $hBitmap)
    $hObj = _SendMessage($hWnd, 0x0173)
    If $hObj <> $hBitmap Then
    _WinAPI_DeleteObject($hBitmap)
    EndIf
    Return 1
    EndFunc ;==>__SetIconAlpha

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

    Func __WinAPI_ShellExtractIcons($sIcon, $iIndex, $iWidth, $iHeight)
    Local $ret = DllCall('shell32.dll', 'int', 'SHExtractIconsW', 'wstr', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr*', 0, 'ptr*', 0, 'int', 1, 'int', 0)
    If (@error) Or ($ret[0] = 0) Or ($ret[5] = Ptr(0)) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $ret[5]
    EndFunc ;==>__WinAPI_ShellExtractIcons

    [/autoit]

    Bilder,Icons und die Include stehen als Download bereit:
    autoit.de/wcf/attachment/20857/

  • Ich würde mal sagen, das sagt alles!

    [autoit]

    $2Button1 = GUICtrlCreateButton("Weiter", 501, 392, 131, 33)
    GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
    GUICtrlSetState(-1,$GUI_DISABLE)
    GUICtrlSetOnEvent(-1,"_Exit")

    [/autoit]
  • Achso musst auch sagen welchen Button du meinst. Was kommt den für eine Fehlermeldung in der Console?

  • Und hier ein Screen vom Absturzt:
    [Blockierte Grafik: http://www.workupload.com/image/Bsoo8Rd]

    Die Console sagt folgendes:

    Spoiler anzeigen


    >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Delux\Desktop\BadBlaster\SMP - Antivirus ( Ja neue Form )\DateiScannerNeu\TICleaner.au3" /UserParams
    +>21:27:14 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0407 Keyboard:00000407 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64)
    >Running AU3Check (1.54.19.0) from:C:\Program Files (x86)\AutoIt3
    +>21:27:14 AU3Check ended.rc:0
    >Running:(3.3.6.1):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\Delux\Desktop\BadBlaster\SMP - Antivirus ( Ja neue Form )\DateiScannerNeu\TICleaner.au3"
    --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
    +>21:27:15 AutoIT3.exe ended.rc:0
    >Exit code: 0 Time: 3.363

    Auf folgenden Maschinen getestet:
    - PC Windows 7 x64 Service Pack 2
    - Laptop Windows 7 x32 Service Pack 2

  • Nach dem wurde es ganz normal beendet. Überprüf doch mal mit ConsoleWrite wo er zuletzt ist vor dem Absturz.

    Warum machst du eigentlich zwei GUI's, wenn die beiden fast gleich sind?

  • Zitat

    Warum machst du eigentlich zwei GUI's, wenn die beiden fast gleich sind?

    'GUI-1' Der Benutzer bekommt Informationen und die Vorgehendsweise des Programmes genau beschrieben und kann dann entscheiden ob er das wirklich will.
    'GUI-2' Zeigt aktuelle Informationen und Statistiken an.

  • Die aktuelle Informationen und Statistiken kannst du doch dann in der GUI-1 auch anzeigen.
    Ich würde das ganze so machen:

    Spoiler anzeigen
    [autoit]

    #NoTrayIcon
    #RequireAdmin
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <WinAPI.au3>
    #include <GDIPlus.au3>
    #include <File.au3>
    #include <Array.au3>
    #include "RecFileListToArray.au3"

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

    FileInstall("header.JPG", @TempDir & "\header.JPG")
    FileInstall('ag.ico', @TempDir & '\ag.ico')

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

    Opt("GUIOnEventMode", 1)

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

    Global $acLabels1[5], $acLabels2[3]

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

    GUICreate("PC-Bereinigung.", 645, 442)
    GUISetFont(10, 400, 0, "Tahoma")
    GUISetBkColor(0xFFFFFF)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUICtrlCreatePic(@TempDir & "\header.JPG", 0, 0, 645, 100)
    $idPB_AddTicket = GUICtrlCreatePic('', 8, 16, 64, 64)
    __SetIconAlpha($idPB_AddTicket, @TempDir & '\ag.ico', 0, 64, 64)
    GUICtrlCreateLabel("PC-Bereinigung", 80, 34, 237, 30)
    GUICtrlSetFont(-1, 12, 800, 0, "Tahoma")
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlCreateLabel("Verbessern Sie die Leistung ihres Computers.", 80, 56, 299, 22)
    GUICtrlSetBkColor(-1, -2)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlCreateGroup("", 8, 104, 631, 329)
    GUICtrlCreateLabel("Wichtiger Hinweis", 16, 120, 119, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    GUICtrlCreateLabel("Durch die Bereinigung wird die Leistung Ihres Computers verbessert, indem Objekte entfernt werden, die", 16, 144, 605, 20)
    GUICtrlCreateLabel("nicht mehr gebraucht werden, z.B. temporäre Internetdateien und Cookies. Es werden keine aktuellen", 16, 160, 587, 20)
    $Button1 = GUICtrlCreateButton("Weiter", 501, 392, 131, 33)
    GUICtrlSetOnEvent(-1, "_CleanUpAll")
    $Button2 = GUICtrlCreateButton("Abbrechen", 15, 392, 131, 33)
    GUICtrlSetOnEvent(-1, "_Exit")
    GUICtrlCreateLabel("Dateien gelöscht.", 16, 176, 102, 20)
    $acLabels1[0] = GUICtrlCreateLabel("Folgende Browser werden bereinigt", 16, 208, 234, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    $acLabels1[1] = GUICtrlCreateLabel("• Mozilla-Firefox", 16, 232, 97, 20)
    $acLabels1[2] = GUICtrlCreateLabel("• Internet-Explorer", 16, 256, 111, 20)
    $acLabels1[3] = GUICtrlCreateLabel("• Google-Chrome", 16, 280, 102, 20)
    $acLabels1[4] = GUICtrlCreateLabel("Klicken Sie auf 'Weiter' um den Vorgang zu starten.", 16, 368, 318, 20)
    $acLabels2[0] = GUICtrlCreateLabel("Status", 16, 208, 47, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
    GUICtrlSetState(-1, $GUI_HIDE)
    $acLabels2[1] = GUICtrlCreateLabel("Cookies und temporäre Internetdateien werden entfernt ...", 16, 232, 336, 20)
    GUICtrlSetState(-1, $GUI_HIDE)
    $acLabels2[2] = GUICtrlCreateLabel("Klicken Sie auf 'Fertigstellen' um den Vorgang abzuschließen.", 16, 368, 350, 20)
    GUICtrlSetState(-1, $GUI_HIDE)
    $Progress1 = GUICtrlCreateProgress(16, 248, 614, 29)
    GUICtrlSetState(-1, $GUI_HIDE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState()

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

    While 1
    Sleep(100)
    WEnd

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

    Func _Exit()
    Exit
    EndFunc ;==>_Exit

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

    Func _CleanUpAll()
    For $i = 0 To UBound($acLabels1) - 1
    GUICtrlSetState($acLabels1[$i], $GUI_HIDE)
    Next
    For $i = 0 To UBound($acLabels2) - 1
    GUICtrlSetState($acLabels2[$i], $GUI_SHOW)
    Next
    GUICtrlSetState($Progress1, $GUI_SHOW)
    GUICtrlSetState($Button1, $GUI_DISABLE)
    GUICtrlSetData($Button1, "Fertigstellen")
    GUICtrlSetData($Progress1, 5)
    clean_profiles()
    GUICtrlSetData($Progress1, 100)
    GUICtrlSetOnEvent($Button1, "_Exit")
    GUICtrlSetState($Button1, $GUI_ENABLE)
    EndFunc ;==>_CleanUpAll

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

    Func clean_profiles()
    $userdir = StringTrimRight(@UserProfileDir, StringLen(@UserName) + 1) ; $userdir = path of users directories. For example, C:\Users for Windows 7
    $listing = _FileListToArray($userdir, "*", 2) ;returns an array containing the name of all users directories

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

    $i = 1
    Do
    If StringInStr(FileGetAttrib($userdir & "\" & $listing[$i]), "H") <> 0 Then ;if the folder has "hidden" as attribute (system user), we remove it from $listing array
    _ArrayDelete($listing, $i)
    $listing[0] -= 1
    Else
    $i += 1
    EndIf
    Until $listing[0] == $i

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

    For $i = 1 To $listing[0] Step 1 ; for all user directories, we clean the below folders:
    If @OSVersion == "WIN_7" Then
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Microsoft\Windows\Temporary Internet Files")
    GUICtrlSetData($Progress1, 10)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Temp")
    GUICtrlSetData($Progress1, 20)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\LocalLow\Temp")
    GUICtrlSetData($Progress1, 30)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Google\Chrome\User Data\Default\Cache")
    GUICtrlSetData($Progress1, 40)

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

    $firefox = _FileListToArray(@HomeDrive & "\Users\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles", "*", 2)

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

    If IsArray($firefox) Then ; if at least 1 firefox profile is found, we clean it/them
    For $k = 1 To $firefox[0] Step 1
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\Cache")
    GUICtrlSetData($Progress1, 50)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\OfflineCache")
    GUICtrlSetData($Progress1, 60)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\startupCache")
    GUICtrlSetData($Progress1, 70)
    Next
    EndIf
    ElseIf @OSVersion == "WIN_XP" Then
    delfolder($userdir & "\" & $listing[$i] & "\Local Settings\Temporary Internet Files")
    GUICtrlSetData($Progress1, 10)
    delfolder($userdir & "\" & $listing[$i] & "\Local Settings\Temp")
    GUICtrlSetData($Progress1, 20)
    delfolder($userdir & "\" & $listing[$i] & "\Local Settings\Application Data\Google\Chrome\User Data\Default\Cache")
    GUICtrlSetData($Progress1, 30)

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

    $firefox = _FileListToArray(@HomeDrive & "\Users\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles", "*", 2)

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

    If IsArray($firefox) Then ; if at least 1 firefox profile is found, we clean it/them
    For $k = 1 To $firefox[0] Step 1
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\Cache")
    GUICtrlSetData($Progress1, 40)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\OfflineCache")
    GUICtrlSetData($Progress1, 50)
    delfolder($userdir & "\" & $listing[$i] & "\AppData\Local\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\startupCache")
    GUICtrlSetData($Progress1, 60)
    Next
    EndIf
    EndIf
    Next
    EndFunc ;==>clean_profiles

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

    Func delfolder($folder)
    $dirlisting = _RecFileListToArray($folder, "*", 14, 1) ;getting all folders/subfolders into an array

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

    If IsArray($dirlisting) Then ;if the folder contains subfolder, we delete everything inside each subfolders
    FileDelete($folder & "\*.*")
    For $i = 1 To $dirlisting[0] Step 1
    FileDelete($folder & "\" & $dirlisting[$i] & "\*.*")
    DirRemove($folder & "\" & $dirlisting[$i], 1)
    Next
    Else ;if the folder doesn't contains subfolder, we simply delete what's inside it.
    FileDelete($folder & "\*.*")
    EndIf
    EndFunc ;==>delfolder

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

    Func __SetIconAlpha($hWnd, $sIcon, $iIndex, $iWidth, $iHeight)
    If Not IsHWnd($hWnd) Then
    $hWnd = GUICtrlGetHandle($hWnd)
    If $hWnd = 0 Then
    Return SetError(1, 0, 0)
    EndIf
    EndIf
    Local $hIcon = __WinAPI_ShellExtractIcons($sIcon, $iIndex, $iWidth, $iHeight)
    If $hIcon = 0 Then
    Return SetError(1, 0, 0)
    EndIf
    Local $hBitmap, $hObj, $hDC, $hMem, $hSv
    $hDC = _WinAPI_GetDC($hWnd)
    $hMem = _WinAPI_CreateCompatibleDC($hDC)
    $hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
    $hSv = _WinAPI_SelectObject($hMem, $hBitmap)
    _WinAPI_DrawIconEx($hMem, 0, 0, $hIcon, $iWidth, $iHeight, 0, 0, 2)
    _WinAPI_ReleaseDC($hWnd, $hDC)
    _WinAPI_SelectObject($hMem, $hSv)
    _WinAPI_DeleteDC($hMem)
    _WinAPI_DestroyIcon($hIcon)
    _WinAPI_DeleteObject(_SendMessage($hWnd, 0x0172, 0, 0))
    _SendMessage($hWnd, 0x0172, 0, $hBitmap)
    $hObj = _SendMessage($hWnd, 0x0173)
    If $hObj <> $hBitmap Then
    _WinAPI_DeleteObject($hBitmap)
    EndIf
    Return 1
    EndFunc ;==>__SetIconAlpha

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

    Func __WinAPI_ShellExtractIcons($sIcon, $iIndex, $iWidth, $iHeight)
    Local $ret = DllCall('shell32.dll', 'int', 'SHExtractIconsW', 'wstr', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr*', 0, 'ptr*', 0, 'int', 1, 'int', 0)
    If (@error) Or ($ret[0] = 0) Or ($ret[5] = Ptr(0)) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $ret[5]
    EndFunc ;==>__WinAPI_ShellExtractIcons

    [/autoit]