Func _exit() Exit EndFunc ;==>_exit Func f_RestartScript() If @Compiled = 1 Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf _exit() EndFunc ;==>f_RestartScript Func f_EndMsg() $s_MsgBox = MsgBox(68, "Done", "Clean complete. Clean something else?" & @CRLF & "Click YES to clean again, NO to exit.") If $s_MsgBox = 6 Then f_RestartScript() ElseIf $s_MsgBox <> 6 Then _exit() EndIf EndFunc ;==>f_EndMsg Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func f_SelectAllWB() GUICtrlSetState($a_Checkbox[1][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[2][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[3][0], $GUI_CHECKED) GUICtrlSetPos($g_SubmitAndClean, 264, 360, 120, 85) If _IsChecked($a_Checkbox[4][0]) Then GUICtrlSetState($a_Checkbox[4][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[5][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[6][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[7][0], $GUI_UNCHECKED) ElseIf _IsChecked($a_Checkbox[5][0]) Then GUICtrlSetState($a_Checkbox[4][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[5][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[6][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[7][0], $GUI_UNCHECKED) ElseIf _IsChecked($a_Checkbox[6][0]) Then GUICtrlSetState($a_Checkbox[4][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[5][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[6][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[7][0], $GUI_UNCHECKED) ElseIf _IsChecked($a_Checkbox[7][0]) Then GUICtrlSetState($a_Checkbox[4][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[5][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[6][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[7][0], $GUI_UNCHECKED) EndIf EndFunc ;==>f_SelectAllWB Func f_WinExplOnly() GUICtrlSetState($a_Checkbox[4][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[5][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[6][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[7][0], $GUI_CHECKED) GUICtrlSetPos($g_SubmitAndClean, 264, 360, 120, 85) If _IsChecked($a_Checkbox[1][0]) Then GUICtrlSetState($a_Checkbox[1][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[2][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[3][0], $GUI_UNCHECKED) ElseIf _IsChecked($a_Checkbox[2][0]) Then GUICtrlSetState($a_Checkbox[1][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[2][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[3][0], $GUI_UNCHECKED) ElseIf _IsChecked($a_Checkbox[3][0]) Then GUICtrlSetState($a_Checkbox[1][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[2][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[3][0], $GUI_UNCHECKED) EndIf EndFunc ;==>f_WinExplOnly Func f_SelAll() GUICtrlSetState($a_Checkbox[1][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[2][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[3][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[4][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[5][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[6][0], $GUI_CHECKED) GUICtrlSetState($a_Checkbox[7][0], $GUI_CHECKED) GUICtrlSetPos($g_SubmitAndClean, 264, 360, 120, 85) EndFunc ;==>f_SelAll Func f_SelNone() GUICtrlSetPos($g_SubmitAndClean, 1000, 360, 120, 85) GUICtrlSetState($a_Checkbox[1][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[2][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[3][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[4][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[5][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[6][0], $GUI_UNCHECKED) GUICtrlSetState($a_Checkbox[7][0], $GUI_UNCHECKED) GUICtrlSetData($g_Label3, "Ready to clean!") GUICtrlSetData($ChecksProgress, 0) EndFunc ;==>f_SelNone Func activeBtn() If _IsChecked($a_Checkbox[1][0]) Or _IsChecked($a_Checkbox[2][0]) Or _IsChecked($a_Checkbox[3][0]) Or _IsChecked($a_Checkbox[4][0]) Or _IsChecked($a_Checkbox[5][0]) Or _IsChecked($a_Checkbox[6][0]) Or _IsChecked($a_Checkbox[7][0]) Then GUICtrlSetPos($g_SubmitAndClean, 264, 360, 120, 85) ElseIf Not _IsChecked($a_Checkbox[1][0]) Or _IsChecked($a_Checkbox[2][0]) Or _IsChecked($a_Checkbox[3][0]) Or _IsChecked($a_Checkbox[4][0]) Or _IsChecked($a_Checkbox[5][0]) Or _IsChecked($a_Checkbox[6][0]) Or _IsChecked($a_Checkbox[7][0]) Then GUICtrlSetPos($g_SubmitAndClean, 1000, 360, 120, 85) EndIf EndFunc ;==>activeBtn Func f_EnableBtns() GUICtrlSetPos($g_SelWB, 16, 360, 150, 25) GUICtrlSetPos($g_SelWinExpl, 16, 390, 150, 25) GUICtrlSetPos($g_SelAll, 16, 420, 70, 25) GUICtrlSetPos($g_SelNone, 95, 420, 70, 25) GUICtrlSetPos($g_SubmitAndClean, 264, 360, 120, 85) EndFunc ;==>f_EnableBtns Func f_DIsableBtns() GUICtrlSetPos($g_SelWB, 1000, 360, 120, 85) GUICtrlSetPos($g_SelWinExpl, 1000, 360, 120, 85) GUICtrlSetPos($g_SelAll, 1000, 360, 120, 85) GUICtrlSetPos($g_SelNone, 1000, 360, 120, 85) GUICtrlSetPos($g_SubmitAndClean, 1000, 360, 120, 85) EndFunc ;==>f_DIsableBtns Func f_EmptyFolder($s_FolderToDelete) $AllFiles = _FileListToArray($s_FolderToDelete, "*", 0) If $s_Debug Then ConsoleWrite("-->" & $s_FolderToDelete & @CRLF) If IsArray($AllFiles) Then If $s_Debug Then _ArrayDisplay($AllFiles, $s_FolderToDelete) EndIf For $i = 1 To $AllFiles[0] $crt = FileGetTime($s_FolderToDelete & "\" & $AllFiles[$i], 1) ; If $crt[2] = @MDAY And $crt[0] = @YEAR And $crt[1] = @MON Then ; ContinueLoop ; EndIf $delete = FileDelete($s_FolderToDelete & "\" & $AllFiles[$i]) If $s_Debug Then ConsoleWrite($s_FolderToDelete & "\" & $AllFiles[$i] & " =>" & $delete & @CRLF) EndIf DirRemove($s_FolderToDelete & "\" & $AllFiles[$i], 1) Next EndIf EndFunc ;==>f_EmptyFolder Func f_SumitAndClean() GUICtrlSetData($g_Label3, "Preparing Multi-threading for deletion...") $iCount = 0 For $i = 1 To $a_Checkbox[0][0] If GUICtrlRead($a_Checkbox[$i][0]) = 1 Then $iCount += 1 Next $iSegment = Int(100 / $iCount) If _IsChecked($a_Checkbox[1][0]) Then f_EmptyFolder(@AppDataDir & "\Microsoft\Windows\Cookies") f_EmptyFolder(@AppDataDir & "\Microsoft\Windows\IECompatCache") f_EmptyFolder(@AppDataDir & "\Microsoft\Windows\IECompatUACache") f_EmptyFolder(@AppDataDir & "\Microsoft\Windows\IETldCache") ShellExecuteWait("RunDll32.exe", " InetCpl.cpl,ClearMyTracksByProcess 2062") GUICtrlSetData($g_Label3, "Cleaning IE") GUICtrlSetData($ChecksProgress, GUICtrlRead($ChecksProgress) + $iSegment) Sleep(1000) GUICtrlSetData($ChecksProgress, GUICtrlRead($ChecksProgress) + $iSegment) EndIf If _IsChecked($a_Checkbox[2][0]) Then f_EmptyFolder(@LocalAppDataDir & "\Google\Chrome\User Data\Default\Cache") f_EmptyFolder(@LocalAppDataDir & "\Google\Chrome\User Data\Profile 1\Cache") f_EmptyFolder(@LocalAppDataDir & "\Google\Chrome\User Data\Profile 2\Cache") f_EmptyFolder(@LocalAppDataDir & "\Google\Chrome\User Data\Profile 3\Cache") f_EmptyFolder(@LocalAppDataDir & "\Google\Chrome\User Data\Profile 4\Cache") f_EmptyFolder(@LocalAppDataDir & "\Google\Chrome\User Data\Profile 5\Cache") GUICtrlSetData($g_Label3, "Cleaning Chrome") GUICtrlSetData($ChecksProgress, GUICtrlRead($ChecksProgress) + $iSegment) EndIf If _IsChecked($a_Checkbox[3][0]) Then $firefox = _FileListToArray(@LocalAppDataDir & "\Mozilla\Firefox\Profiles", "*", 2) For $k = 1 To $firefox[0] Step 1 DirRemove(@LocalAppDataDir & "\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\Cache2", 1) DirRemove(@LocalAppDataDir & "\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\Cache", 1) DirRemove(@LocalAppDataDir & "\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\StartupCache", 1) DirRemove(@LocalAppDataDir & "\Mozilla\Firefox\Profiles\" & $firefox[$k] & "\JumplistCache", 1) ExitLoop Next GUICtrlSetData($g_Label3, "Cleaning Firefox") GUICtrlSetData($ChecksProgress, $iSegment) EndIf If _IsChecked($a_Checkbox[4][0]) Then f_EmptyFolder(@HomeDrive & "\Temp\") f_EmptyFolder(@WindowsDir & "\Temp\") GUICtrlSetData($g_Label3, "Cleaning Temp folders") GUICtrlSetData($ChecksProgress, GUICtrlRead($ChecksProgress) + $iSegment) Sleep(1000) EndIf If _IsChecked($a_Checkbox[5][0]) Then f_EmptyFolder(@AppDataDir & "\Microsoft\Windows\Recent\") GUICtrlSetData($g_Label3, "Cleaning Recent folder") GUICtrlSetData($ChecksProgress, GUICtrlRead($ChecksProgress) + $iSegment) Sleep(1000) EndIf If _IsChecked($a_Checkbox[6][0]) Then f_EmptyFolder(@LocalAppDataDir & "\Temp\") f_EmptyFolder(@LocalAppDataDir & "Low" & "\Temp\") GUICtrlSetData($g_Label3, "Cleaning Local + Local Low \Temp folders") GUICtrlSetData($ChecksProgress, GUICtrlRead($ChecksProgress) + $iSegment) Sleep(1000) EndIf If _IsChecked($a_Checkbox[7][0]) Then f_EmptyFolder(@LocalAppDataDir & "\Temp\") f_EmptyFolder(@LocalAppDataDir & "Low" & "\Temp\") GUICtrlSetData($g_Label3, "Cleaning other Local Settings\Temp folder ") GUICtrlSetData($ChecksProgress, GUICtrlRead($ChecksProgress) + $iSegment) Sleep(1000) EndIf GUICtrlSetData($ChecksProgress, 100) f_EndMsg() EndFunc ;==>f_SumitAndClean