本帖最后由 水木子 于 2010-12-2 10:15 编辑
帮你做了一个,其他的同理即可。
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <GuiComboBoxEx.au3>
#include <TabConstants.au3>
#include <GUITab.au3>
#include <ListviewConstants.au3>
#include <GuiListView.au3>
#include <ListBoxConstants.au3>
#include <StaticConstants.au3>
#include <Process.au3>
#include <GuiListView.au3>
#include <Constants.au3>
#include <IE.au3>
Opt('TrayIconHide', 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("垃圾清理", 623, 449, 192, 114)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Tabhead2 = GUICtrlCreateTabItem("垃圾清理")
;$Tabhead5 = GUICtrlCreateTabItem("清理项目")
$tab5list5 = GUICtrlCreateListView("", 8, 105, 350, 251)
_GUICtrlListView_SetExtendedListViewStyle($tab5list5, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_SUBITEMIMAGES))
;_bb()
; Add columns
Dim $FileName, $del = " /C del /f /s /q /a ", $del2 = " /C del /f /q /a ", $rd = " /C rd /s /q "
;Func _bb()
;EndFunc
_GUICtrlListView_AddColumn($tab5list5, "清理项目", 160)
_GUICtrlListView_AddColumn($tab5list5, "占用空间", 90)
_GUICtrlListView_AddColumn($tab5list5, "所属类型", 110)
Local $temp, $add01 = "0", $prefetch, $add02 = "0", $ie_internet, $add03 = "0", $ie_cookie, $add04 = "0"
_aa()
_GUICtrlListView_AddItem($tab5list5, "应用程序历史临时文件", 0)
_GUICtrlListView_AddSubItem($tab5list5, 0, $add01 & ' MB', 1, 1)
_GUICtrlListView_AddSubItem($tab5list5, 0, "临时文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "用户日常操作临时文件", 1)
_GUICtrlListView_AddSubItem($tab5list5, 1, $add02 & " MB", 1, 2)
_GUICtrlListView_AddSubItem($tab5list5, 1, "临时文件", 2, 1)
_GUICtrlListView_AddItem($tab5list5, "internet历史临时文件", 2)
_GUICtrlListView_AddSubItem($tab5list5, 2, $add03 & " MB", 1, 3)
_GUICtrlListView_AddSubItem($tab5list5, 2, "临时文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "internet Cookie 缓存", 3)
_GUICtrlListView_AddSubItem($tab5list5, 3, $add04 & " MB", 1, 4)
_GUICtrlListView_AddSubItem($tab5list5, 3, "临时文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "系统用户访问记录", 4)
_GUICtrlListView_AddSubItem($tab5list5, 4, "0 MB", 1, 5)
_GUICtrlListView_AddSubItem($tab5list5, 4, "临时文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "回收站中无用文件", 5)
_GUICtrlListView_AddSubItem($tab5list5, 5, "0 MB", 1, 6)
_GUICtrlListView_AddSubItem($tab5list5, 5, "临时文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "操作系统备份文件", 6)
_GUICtrlListView_AddSubItem($tab5list5, 6, "0 MB", 1, 7)
_GUICtrlListView_AddSubItem($tab5list5, 6, "备份文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "操作系统备份目录", 7)
_GUICtrlListView_AddSubItem($tab5list5, 7, "0 MB", 1, 8)
_GUICtrlListView_AddSubItem($tab5list5, 7, "备份文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "系统补丁备份目录", 8)
_GUICtrlListView_AddSubItem($tab5list5, 8, "0 MB", 1, 9)
_GUICtrlListView_AddSubItem($tab5list5, 8, "备份文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "补丁安装记录文件", 9)
_GUICtrlListView_AddSubItem($tab5list5, 9, "0 MB", 1, 10)
_GUICtrlListView_AddSubItem($tab5list5, 9, "备份文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "用户公用示例文件", 10)
_GUICtrlListView_AddSubItem($tab5list5, 10, "0 MB", 1, 11)
_GUICtrlListView_AddSubItem($tab5list5, 10, "备份文件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "windows帮助中心", 11)
_GUICtrlListView_AddSubItem($tab5list5, 11, "0 MB", 1, 12)
_GUICtrlListView_AddSubItem($tab5list5, 11, "可精简组件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "系统日文输入法", 12)
_GUICtrlListView_AddSubItem($tab5list5, 12, "0 MB", 1, 13)
_GUICtrlListView_AddSubItem($tab5list5, 12, "可精简组件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "系统韩文输入法", 13)
_GUICtrlListView_AddSubItem($tab5list5, 13, "0 MB", 1, 14)
_GUICtrlListView_AddSubItem($tab5list5, 13, "可精简组件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "系统繁体输入法", 14)
_GUICtrlListView_AddSubItem($tab5list5, 14, "0 MB", 1, 15)
_GUICtrlListView_AddSubItem($tab5list5, 14, "可精简组件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "微软拼音输入法", 15)
_GUICtrlListView_AddSubItem($tab5list5, 15, "0 MB", 1, 16)
_GUICtrlListView_AddSubItem($tab5list5, 15, "可精简组件", 2, 2)
_GUICtrlListView_AddItem($tab5list5, "其它自带输入法", 16)
_GUICtrlListView_AddSubItem($tab5list5, 16, "0 MB", 1, 17)
_GUICtrlListView_AddSubItem($tab5list5, 16, "可精简组件", 2, 2)
$Group1 = GUICtrlCreateGroup("清理项目介绍", 376, 105, 209, 188)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 376, 292, 209, 59)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("< 返 回(B)", 328, 354, 81, 33)
$Button2 = GUICtrlCreateButton("清 理(S)", 416, 354, 81, 33)
$Button3 = GUICtrlCreateButton("完 成(F)>", 504, 354, 81, 33)
$tab5check01 = GUICtrlCreateCheckbox("临时文件", 16, 365, 70, 17)
$tab5check02 = GUICtrlCreateCheckbox("备份文件", 96, 365, 70, 17)
$tab5check03 = GUICtrlCreateCheckbox("可精简组件", 184, 365, 130, 17)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
_Dirremove(@TempDir)
_Dirremove(@WindowsDir & "\temp")
Case $tab5check01
For $i = 0 To _GUICtrlListView_GetItemCount($tab5list5) - 1
If _GUICtrlListView_GetItemText($tab5list5, $i, 2) = '临时文件' Then
_GUICtrlListView_SetItemChecked($tab5list5, $i)
EndIf
Next
Case $tab5check02
Case $tab5check03
EndSwitch
WEnd
Func _aa()
$prefetch = DirGetSize(@WindowsDir & "/Prefetch", 0)
$add01 = Round($prefetch / 1024 / 1024)
;_GUICtrlListView_AddItem($tab5list5, "应用程序历史临时文件", 0)
_GUICtrlListView_AddSubItem($tab5list5, 0, $add01 & ' MB', 1, 1)
;_GUICtrlListView_AddSubItem($tab5list5, 0, "临时文件", 2, 2)
$widowstemp = DirGetSize(@WindowsDir & "\temp", 0)
$temp = DirGetSize(@TempDir, 0)
$01 = Round($temp / 1024 / 1024)
$02 = Round($widowstemp / 1024 / 1024)
$add02 = $01 + $02
;_GUICtrlListView_AddItem($tab5list5, "用户日常操作临时文件", 1)
_GUICtrlListView_AddSubItem($tab5list5, 1, $add02 & " MB", 1, 2)
;_GUICtrlListView_AddSubItem($tab5list5, 1, "临时文件", 2, 1)
$IE_Cache = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Cache")
;MsgBox (0,"",$IE_Cache)
$ie_internet = DirGetSize($IE_Cache, 0)
$add03 = Round($ie_internet / 1048576)
;_GUICtrlListView_AddItem($tab5list5, "internet历史临时文件", 2)
_GUICtrlListView_AddSubItem($tab5list5, 2, $add03 & " MB", 1, 3)
;_GUICtrlListView_AddSubItem($tab5list5, 2, "临时文件", 2, 2)
$ie_cookie = DirGetSize(@UserProfileDir & "/Cookies", 0)
;MsgBox(0,"",@UserProfileDir)
$add04 = Round($ie_cookie / 1024 / 1024)
;_GUICtrlListView_AddItem($tab5list5, "internet Cookie 缓存", 3)
_GUICtrlListView_AddSubItem($tab5list5, 3, $add04 & " MB", 1, 4)
;_GUICtrlListView_AddSubItem($tab5list5, 3, "临时文件", 2, 2)
EndFunc ;==>_aa
Func _Dirremove($searchdir)
$search = FileFindFirstFile($searchdir & "\*.*")
If $search = -1 Then Return
While 1
$file = FileFindNextFile($search)
If @error Then
ExitLoop
ElseIf StringInStr(FileGetAttrib($searchdir & "\" & $file), "S") Then
DirRemove($searchdir & "\" & $file, 0)
ElseIf StringInStr(FileGetAttrib($searchdir & "\" & $file), "D") Then
DirRemove($searchdir & "\" & $file, 1)
ElseIf StringInStr(FileGetAttrib($searchdir & "\" & $file), "R") Then
FileSetAttrib($searchdir & "\" & $file, "-R")
FileDelete($searchdir & "\" & $file)
FileSetAttrib($searchdir & "\" & $file, "+R")
Else
FileDelete($searchdir & "\" & $file)
EndIf
RunWait(@ComSpec & $del & '"%tmp%\*.*"', "", @SW_HIDE)
WEnd
_aa()
EndFunc ;==>_Dirremove
|