过期罐头电脑论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2582|回复: 0
收起左侧

系统垃圾清理源码(支持XP/Vista/Win7)

[复制链接]
yaojian 2012-4-24 09:30:24 | 显示全部楼层
$IEDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "Version")
$result = StringLeft($IEDir, 1)
If $result = "6" Then
这段是判断是否IE6,
#RequireAdmin是需要系统管理员或者Administrator身份,

01.#NoTrayIcon
02.#RequireAdmin
03.#Region ;**** 参数创建于 ACNWrapper_GUI ****
04.#AutoIt3Wrapper_outfile=系统垃圾清理.exe
05.#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
06.#include <ModernMenuRaw.au3>
07.
08.Opt("TrayAutoPause", 0)
09.Opt("TrayMenuMode", 3)
10.
11.
12.SetBlueTrayColors()
13.
14.$MenuIcon = _TrayIconCreate("系统垃圾清理 By tinpoko")
15.
16._TrayIconSetState()
17.
18._TrayIconSetClick($MenuIcon, 16)
19.
20.$CBLMenu1 = _TrayCreateContextMenu()
21.$nSideItem1 = _CreateSideMenu($CBLMenu1)
22.
23._SetSideMenuText($nSideItem1, "系统垃圾清理 By tinpoko")
24.
25._SetSideMenuColor($nSideItem1, 0x6cccd7)
26.
27._SetSideMenuBkColor($nSideItem1, 0x7c4712)
28.
29._SetSideMenuBkGradColor($nSideItem1, 0x000000)
30.
31.$gomi = _TrayCreateItem("清空回收站")
32._TrayItemSetIcon(-1)
33.$TempFile = _TrayCreateItem("清理临时文件")
34._TrayItemSetIcon(-1)
35.$HISTORY = _TrayCreateItem("清理历史")
36._TrayItemSetIcon(-1)
37.$Recent = _TrayCreateItem("清理我最近的文档")
38._TrayItemSetIcon(-1)
39.$IeTemp = _TrayCreateItem("清理IE临时文件")
40._TrayItemSetIcon(-1)
41.$LOG = _TrayCreateItem("清理LOG文件")
42._TrayItemSetIcon(-1)
43.$ALL = _TrayCreateItem("回收站以外全部清理(Cookies,表单文件,保存的密码)")
44._TrayItemSetIcon(-1)
45.$exititem = _TrayCreateItem("退出")
46._TrayItemSetIcon(-1)
47.
48.While 1
49._ReduceMemory(@AutoItPID)
50.$msg = GUIGetMsg()
51.Select
52.Case $msg = 0
53.ContinueLoop
54.Case $msg = $IeTemp
55.$IEDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "Version")
56.$result = StringLeft($IEDir, 1)
57.If $result = "6" Then
58.Dim $F = FileOpen(@TempDir & "\SystemClean.vbs", 2)
59.FileWriteLine($F, 'Set Folder=CreateObject("Shell.Application").NameSpace(32)')
60.FileWriteLine($F, 'For Each FolderItem In Folder.Items()')
61.FileWriteLine($F, 'If Left(Folder.GetDetailsOf(FolderItem,1),7)<>"Cookie:" Then FolderItem.InvokeVerb("delete")')
62.FileWriteLine($F, 'Next')
63.FileClose($F)
64.RunWait(@ComSpec & " /c call " & @TempDir & "\SystemClean.vbs", @ScriptDir, @SW_HIDE)
65._Dirremove(@AppDataDir & "\Macromedia\Flash Player")
66.Sleep(1000)
67.MsgBox(0, "", "清理IE临时文件完成!", 1)
68.Else
69.RunWait(@ComSpec & " /C rundll32.exe " & @SystemDir & "\InetCpl.cpl,ClearMyTracksByProcess 8", "", @SW_HIDE)
70._Dirremove(@AppDataDir & "\Macromedia\Flash Player")
71.Sleep(1000)
72.MsgBox(0, "", "清理IE临时文件完成!", 1)
73.EndIf
74.Case $msg = $HISTORY
75.$IEDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "Version")
76.$result = StringLeft($IEDir, 1)
77.If $result = "6" Then
78.Dim $F = FileOpen(@TempDir & "\SystemClean.vbs", 2)
79.FileWriteLine($F, 'CreateObject("Shell.Application").NameSpace(34).Items().InvokeVerbEx("delete")')
80.FileClose($F)
81.RunWait(@ComSpec & " /c call " & @TempDir & "\SystemClean.vbs", @ScriptDir, @SW_HIDE)
82.Else
83.RunWait(@ComSpec & " /C rundll32.exe " & @SystemDir & "\InetCpl.cpl,ClearMyTracksByProcess 1", "", @SW_HIDE)
84.Sleep(1000)
85.MsgBox(0, "", "清理历史完成!", 1)
86.EndIf
87.Case $msg = $Recent
88.RunWait(@ComSpec & ' /c Del "%userprofile%\Recent\*.lnk">nul 2>nul', @ScriptDir, @SW_HIDE)
89.Sleep(1000)
90.MsgBox(0, "", "清理我最近的文档完成!", 1)
91.Case $msg = $ALL
92.$IEDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer", "Version")
93.$result = StringLeft($IEDir, 1)
94.If $result = "6" Then
95.RunWait(@ComSpec & ' /c Del "%userprofile%\Recent\*.lnk">nul 2>nul', @ScriptDir, @SW_HIDE)
96.Dim $F = FileOpen(@TempDir & "\SystemClean.vbs", 2)
97.FileWriteLine($F, 'CreateObject("Shell.Application").NameSpace(34).Items().InvokeVerbEx("delete")')
98.FileWriteLine($F, 'CreateObject("Shell.Application").NameSpace(32).Items().InvokeVerbEx("delete")')
99.FileClose($F)
100.RunWait(@ComSpec & " /c call " & @TempDir & "\SystemClean.vbs", @ScriptDir, @SW_HIDE)
101.RunWait(@ComSpec & ' /c attrib -r -a -s -h "%systemdrive%\*.log" /d /s>nul 2>nul', @ScriptDir, @SW_HIDE)
102.RunWait(@ComSpec & ' /c del /f /s /q "%systemdrive%\*.log">nul 2>nul', @ScriptDir, @SW_HIDE)
103.$TempDir = RegRead("HKEY_CURRENT_USER\Environment", "TEMP")
104._Dirremove(@TempDir)
105._Dirremove(@WindowsDir & "\temp")
106._Dirremove(@AppDataDir & "\Macromedia\Flash Player")
107.RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU")
108.RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU")
109.ClipPut("")
110._Update_Explorer()
111.Sleep(1000)
112.MsgBox(0, "", "回收站以外全部清理完成!", 1)
113.Else
114.RunWait(@ComSpec & " /C rundll32.exe " & @SystemDir & "\InetCpl.cpl,ClearMyTracksByProcess 4351", "", @SW_HIDE)
115.RunWait(@ComSpec & ' /c Del "%userprofile%\Recent\*.lnk">nul 2>nul', @ScriptDir, @SW_HIDE)
116.RunWait(@ComSpec & ' /c attrib -r -a -s -h "%systemdrive%\*.log" /d /s>nul 2>nul', @ScriptDir, @SW_HIDE)
117.RunWait(@ComSpec & ' /c del /f /s /q "%systemdrive%\*.log">nul 2>nul', @ScriptDir, @SW_HIDE)
118._Dirremove(@TempDir)
119._Dirremove(@WindowsDir & "\temp")
120._Dirremove(@AppDataDir & "\Macromedia\Flash Player")
121.RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU")
122.RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU")
123.ClipPut("")
124._Update_Explorer()
125.Sleep(1000)
126.MsgBox(0, "", "回收站以外全部清理完成!", 1)
127.EndIf
128.Case $msg = $TempFile
129._Dirremove(@TempDir)
130._Dirremove(@WindowsDir & "\temp")
131.Sleep(1000)
132.MsgBox(0, "", "清理临时文件完成!", 1)
133.Case $msg = $LOG
134.RunWait(@ComSpec & ' /c attrib -r -a -s -h "%systemdrive%\*.log" /d /s>nul 2>nul', @ScriptDir, @SW_HIDE)
135.RunWait(@ComSpec & ' /c del /f /s /q "%systemdrive%\*.log">nul 2>nul', @ScriptDir, @SW_HIDE)
136.Sleep(1000)
137.MsgBox(0, "", "清理LOG文件完成!", 1)
138.Case $msg = $gomi
139.$Flag = MsgBox(4, "清空回收站", "真的要清空回收站吗?")
140.If $Flag = 6 Then
141.FileRecycleEmpty()
142.Sleep(1000)
143.MsgBox(0, "", "清空回收站完成!", 1)
144.Else
145.ContinueLoop
146.EndIf
147.Case $msg = $exititem
148.Exit
149.EndSelect
150.WEnd
151.
152.Func _Update_Explorer()
153.Local $bOld = Opt("WinSearchChildren", True)
154.Local $a = WinList("[CLASS:SHELLDLL_DefView]")
155.For $i = 0 To UBound($a) - 1
156.DllCall("user32.dll", "long", "SendMessage", "hwnd", $a[$i][1], "int", 0x111, "int", 28931, "int", 0)
157.Next
158.Opt("WinSearchChildren", $bOld)
159.EndFunc ;==>_Update_Explorer
160.
161.Func _Dirremove($searchdir)
162.
163.$search = FileFindFirstFile($searchdir & "\*.*")
164.If $search = -1 Then Return
165.While 1
166.$file = FileFindNextFile($search)
167.If @error Then
168.ExitLoop
169.ElseIf StringInStr(FileGetAttrib($searchdir & "\" & $file), "S") Then
170.DirRemove($searchdir & "\" & $file, 0)
171.ElseIf StringInStr(FileGetAttrib($searchdir & "\" & $file), "D") Then
172.DirRemove($searchdir & "\" & $file, 1)
173.ElseIf StringInStr(FileGetAttrib($searchdir & "\" & $file), "R") Then
174.FileSetAttrib($searchdir & "\" & $file, "-R")
175.FileDelete($searchdir & "\" & $file)
176.FileSetAttrib($searchdir & "\" & $file, "+R")
177.Else
178.FileDelete($searchdir & "\" & $file)
179.EndIf
180.WEnd
181.EndFunc ;==>_Dirremove
182.
183.Func SetBlueTrayColors()
184._SetTrayBkColor(0xF5F5F5)
185._SetTrayIconBkColor(0xf8fca3)
186._SetTrayIconBkGrdColor(0xFF0000)
187._SetTraySelectBkColor(0xa8e9a1)
188._SetTraySelectRectColor(0x4bce3d)
189._SetTraySelectTextColor(0x000000)
190._SetTrayTextColor(0x000000)
191.EndFunc ;==>SetBlueTrayColors
192.
193.Func _ReduceMemory($i_PID = -1)
194.If $i_PID <> -1 Then
195.Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
196.Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
197.DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
198.Else
199.Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
200.EndIf
201.
202.Return $ai_Return[0]
203.EndFunc ;==>_ReduceMemory
您需要登录后才可以回帖 登录 | 注册

本版积分规则

一键重装系统|雨人系统下载|联系我们|网站地图|过期罐头电脑论坛

GMT+8, 2024-11-27 15:29 , Processed in 0.035426 second(s), 26 queries .

官方免责声明:本站内容来自网友和互联网.若侵犯到您的版权.请致信联系,我们将第一时间删除相关内容!

Powered by Discuz!

专注于win7_win10_win11系统下载装机

© 2010-2023 GQGTPC.Com

快速回复 返回顶部 返回列表