#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=win.ico
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ListviewConstants.au3>
#include <Array.au3>
#include <GuiTreeView.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
;#Include <GuiListView.au3>
#include <StaticConstants.au3>
#Include <ACN_MISC.au3>
#Include <File.au3>
;Opt('MustDeclareVars', 0)
;声明总的变量
Global $tab,$msg
;声明tab1所用的变量
Global $Tab1,$tab1_view[26],$tab1Label[25],$TreeView1,$tab1button1,$tab1button2,$tab1button3,$tab1button4,$tab1button5,$progressbar1,$i1,$s1,$t1=25,$m,$nMsg,$o,$Number,$Handle,$tab2_list1
;声明tab2所用的变量
Global $tab2,$tab2_view[13],$tab2Label[12],$TreeView2,$tab2button1,$tab2button2,$tab2button3,$tab2button4,$tab2button5,$progressbar2,$i2,$s2,$t2=12,$text
Global $CookiesAddress,$TemplatesAddress,$RecentAddress,$CacheAddress,$PrintHoodAddress,$HistoryAddress,$DiskRecycle,$x,$iStyle,$tstyle
Global $dir_prefix, $dir_number,$cp_path,$path,$i,$file_number,$file_prefix
;定义风格
;定义树列表风格
$iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
If WinExists("windows7封装辅助工具") Then
MsgBox(32,"","程序已运行,请返回。")
Exit
EndIf
win7tools()
Func win7tools()
;创建窗体
GUICreate("windows7封装辅助工具",440,440,-1,-1,0x00C00000)
;设置字体
GUISetFont(9, 300)
$tab = GUICtrlCreateTab(10, 10, 420, 20)
$progressbar1=GUICtrlCreateProgress (10, 365, 420,20)
$Tab1 = GUICtrlCreateTabItem("系统减肥")
$TreeView1 = GUICtrlCreateTreeView(10, 53, 420, 300, $iStyle, $WS_EX_CLIENTEDGE)
$tab1button1=GUICtrlCreateButton("全选", 10, 400, 70, 20)
$tab1button2=GUICtrlCreateButton("全不选", 80, 400, 70, 20)
$tab1button3=GUICtrlCreateButton("默认", 150, 400, 70, 20)
$tab1button4=GUICtrlCreateButton("清理", 290, 400, 70, 20)
$tab1button5=GUICtrlCreateButton("退出", 360, 400, 70, 20)
$tab1_label1=GUICtrlCreateLabel(" 项具名称 |状态 |说明", 10, 30,420,24,$WS_BORDER)
$tab1_view[1]=GUICtrlCreateTreeViewItem("系统升级补丁备份文件",$TreeView1)
$tab1_view[2]=GUICtrlCreateTreeViewItem("用户公用文件",$TreeView1)
$tab1_view[3]=GUICtrlCreateTreeViewItem("系统自带壁纸和主题",$TreeView1)
$tab1_view[4]=GUICtrlCreateTreeViewItem("不同语言启动界面",$TreeView1)
$tab1_view[5]=GUICtrlCreateTreeViewItem("程序安装解压目录",$TreeView1)
$tab1_view[6]=GUICtrlCreateTreeViewItem("不常用的输入法",$TreeView1)
$tab1_view[7]=GUICtrlCreateTreeViewItem("系统帮助文件",$TreeView1)
$tab1_view[8]=GUICtrlCreateTreeViewItem("系统测试记录文件",$TreeView1)
$tab1_view[9]=GUICtrlCreateTreeViewItem("驱动精减",$TreeView1)
$tab1_view[10]=GUICtrlCreateTreeViewItem("系统相关组件",$TreeView1)
$tab1_view[11]=GUICtrlCreateTreeViewItem("Table PC组件",$tab1_view[10])
$tab1_view[12]=GUICtrlCreateTreeViewItem("Windows自带游戏",$tab1_view[10])
$tab1_view[13]=GUICtrlCreateTreeViewItem("DVD Maker",$tab1_view[10])
$tab1_view[14]=GUICtrlCreateTreeViewItem("媒体中心",$tab1_view[10])
$tab1_view[15]=GUICtrlCreateTreeViewItem("远程差分压缩",$tab1_view[10])
$tab1_view[16]=GUICtrlCreateTreeViewItem("XPS相关组件",$tab1_view[10])
$tab1_view[17]=GUICtrlCreateTreeViewItem("系统垃圾文件清理",$TreeView1)
$tab1_view[18]=GUICtrlCreateTreeViewItem("回收站文件",$tab1_view[17])
$tab1_view[19]=GUICtrlCreateTreeViewItem("临时目录文件",$tab1_view[17])
$tab1_view[20]=GUICtrlCreateTreeViewItem("程序打开文件记录",$tab1_view[17])
$tab1_view[21]=GUICtrlCreateTreeViewItem("索引文件记录",$tab1_view[17])
$tab1_view[22]=GUICtrlCreateTreeViewItem("预读缓存文件",$tab1_view[17])
$tab1_view[23]=GUICtrlCreateTreeViewItem("IE临时文件",$tab1_view[17])
$tab1_view[24]=GUICtrlCreateTreeViewItem("IE历史记录文件",$tab1_view[17])
$tab1_view[25]=GUICtrlCreateTreeViewItem("Cookie文件",$tab1_view[17])
GUICtrlSetState($tab1_view[1],$GUI_DISABLE);为什么禁 用不掉
GUICtrlSetState($tab1_view[10], $GUI_EXPAND)
GUICtrlSetState($tab1_view[17], $GUI_EXPAND)
default_select1()
$tab1Label[1]=GUICtrlCreateLabel ("待清理", 354, 56)
$tab1Label[2]=GUICtrlCreateLabel ("待清理", 354, 76)
$tab1Label[3]=GUICtrlCreateLabel ("待清理", 354, 90)
$tab1Label[4]=GUICtrlCreateLabel ("待清理", 354, 104)
$tab1Label[5]=GUICtrlCreateLabel ("待清理", 354, 118)
$tab1Label[6]=GUICtrlCreateLabel ("待清理", 354, 132)
$tab1Label[7]=GUICtrlCreateLabel ("待清理", 354, 146)
$tab1Label[8]=GUICtrlCreateLabel ("待清理", 354, 160)
$tab1Label[9]=GUICtrlCreateLabel ("待清理", 354, 174)
$tab1Label[10]=GUICtrlCreateLabel ("待清理", 354, 188)
$tab1Label[11]=GUICtrlCreateLabel ("待清理", 354, 202)
$tab1Label[12]=GUICtrlCreateLabel ("待清理", 354, 216)
$tab1Label[13]=GUICtrlCreateLabel ("待清理", 354, 230)
$tab1Label[14]=GUICtrlCreateLabel ("待清理", 354, 244)
$tab2=GUICtrlCreateTabItem("封装优化")
$TreeView2 = GUICtrlCreateTreeView(10, 53, 420, 300, $iStyle,$WS_EX_CLIENTEDGE)
$tab2_view[1]=GUICtrlCreateTreeViewItem("关闭系统休眠",$TreeView2)
$tab2_view[2]=GUICtrlCreateTreeViewItem("关闭UAC",$TreeView2)
$tab2_view[3]=GUICtrlCreateTreeViewItem("关闭错误报告",$TreeView2)
$tab2_view[4]=GUICtrlCreateTreeViewItem("关闭自动更新",$TreeView2)
$tab2_view[5]=GUICtrlCreateTreeViewItem("任务栏始终显示所有图标",$TreeView2)
$tab2_view[6]=GUICtrlCreateTreeViewItem("关闭自动播放",$TreeView2)
$tab2_view[7]=GUICtrlCreateTreeViewItem("桌面显示常用图标",$TreeView2)
$tab2_view[8]=GUICtrlCreateTreeViewItem("右键增加管理权限",$TreeView2)
$tab2_view[9]=GUICtrlCreateTreeViewItem("计算机中增加视频设备",$TreeView2)
$tab2_view[10]=GUICtrlCreateTreeViewItem("删除操作中心图标",$TreeView2)
$tab2_view[11]=GUICtrlCreateTreeViewItem("不从网络搜索驱动",$TreeView2)
$tab2_view[12]=GUICtrlCreateTreeViewItem("禁用远程协助",$TreeView2)
$tab2button1=GUICtrlCreateButton("全选", 10, 400, 70, 20)
$tab2button2=GUICtrlCreateButton("全不选", 80, 400, 70, 20)
$tab2button3=GUICtrlCreateButton("默认", 150, 400, 70, 20)
$tab2button4=GUICtrlCreateButton("优化", 290, 400, 70, 20)
$tab2button5=GUICtrlCreateButton("退出", 360, 400, 70, 20)
$tab2_list1=GUICtrlCreateListView(" 项具名称 |状态 |说明", 10, 30,420,24,$LVS_NOSORTHEADER)
;运行tab2的默认选择
default_select2()
$tab2Label[1]=GUICtrlCreateLabel ("待清理", 354, 55)
$tab2Label[2]=GUICtrlCreateLabel ("待清理", 354, 75)
$tab2Label[3]=GUICtrlCreateLabel ("待清理", 354, 95)
$tab2Label[4]=GUICtrlCreateLabel ("待清理", 354, 115)
$tab2Label[5]=GUICtrlCreateLabel ("待清理", 354, 135)
$tab2Label[6]=GUICtrlCreateLabel ("待清理", 354, 155)
$tab2Label[7]=GUICtrlCreateLabel ("待清理", 354, 175)
$tab2Label[8]=GUICtrlCreateLabel ("待清理", 354, 195)
$progressbar2=GUICtrlCreateProgress (10, 365, 420,20)
GUISetState()
While 1
$msg = GUIGetMsg()
;此段定义父项目勾选 ,子项目也勾选
Select
Case $Msg = $tab1_view[10]
;MsgBox(0,"debug", GUICtrlRead($tab1_view[10]))
if GUICtrlRead($tab1_view[10])=1281 or GUICtrlRead($tab1_view[10])= 257 Then
For $m=11 To 16
GUICtrlSetState($tab1_view[$m], $GUI_CHECKED)
Next
ElseIf GUICtrlRead($tab1_view[10])=1284 Or GUICtrlRead($tab1_view[10])=260 Then
For $m=11 To 16
GUICtrlSetState($tab1_view[$m], $GUI_UNCHECKED)
Next
EndIf
Case $Msg = $tab1_view[17]
If GUICtrlRead($tab1_view[17])=1281 Or GUICtrlRead($tab1_view[17])=257 Then
For $m=18 To 25
GUICtrlSetState($tab1_view[$m], $GUI_CHECKED)
; MsgBox(0,"",GUICtrlRead($tab1_view[$M]))
Next
ElseIf GUICtrlRead($tab1_view[17])=1284 Or GUICtrlRead($tab1_view[17])=260 Then ;反选
For $m=18 To 25
GUICtrlSetState($tab1_view[$m], $GUI_UNCHECKED)
Next
EndIf
EndSelect
;此段定义子项目勾选,父项目也跟着勾选,子项目全部取消,父项目也跟着取消
$n=0
For $m=11 To 16
If GUICtrlRead($tab1_view[10])=1281 Or GUICtrlRead($tab1_view[10])=1284 Or GUICtrlRead($tab1_view[10])=257 Or GUICtrlRead($tab1_view[10])=260 then exitloop
If GUICtrlRead($tab1_view[$m])=1 Or GUICtrlRead($tab1_view[$m])=257 Then
GUICtrlSetState($tab1_view[10], $GUI_CHECKED)
EndIf
If GUICtrlRead($tab1_view[$m])=4 Or GUICtrlRead($tab1_view[$m])=260 Then $n=$n+1
If $n=6 Then GUICtrlSetState($tab1_view[10], $GUI_UNCHECKED)
Next
$n=0
For $m=18 To 25
If GUICtrlRead($tab1_view[17])=1281 Or GUICtrlRead($tab1_view[17])=1284 Or GUICtrlRead($tab1_view[17])=257 Or GUICtrlRead($tab1_view[17])=260 then exitloop
If GUICtrlRead($tab1_view[$m])=1 Or GUICtrlRead($tab1_view[$m])=257 Then
GUICtrlSetState($tab1_view[17], $GUI_CHECKED)
EndIf
If GUICtrlRead($tab1_view[$m])=4 Or GUICtrlRead($tab1_view[$m])=260 Then $n=$n+1
If $n=8 Then GUICtrlSetState($tab1_view[17], $GUI_UNCHECKED)
Next
If $msg = $Tab1button1 Then all_select1()
If $msg = $Tab1button2 Then all_none1()
If $msg = $tab1button3 Then default_select1()
If $msg = $tab1button4 Then clean1()
If $msg = $Tab1button5 Then ExitLoop
If $msg = $Tab2button1 Then all_select2()
If $msg = $Tab2button2 Then all_none2()
If $msg = $Tab2button3 Then default_select2()
If $msg = $Tab2button4 Then clean2()
If $msg = $Tab2button5 Then ExitLoop
WEnd
EndFunc ;==>win7tools
;实现tab1按钮功能
;实现全选功能
Func all_select1()
GUICtrlSetState($tab1button1,$GUI_DISABLE)
For $i1 =1 to $t1
GUICtrlSetState($tab1_view[$i1],$GUI_CHECKED)
Next
GUICtrlSetState($tab1button1,$GUI_ENABLE)
EndFunc
;实现全部不选择功能
Func all_none1()
For $i1 =1 to $t1
GUICtrlSetState($Tab1_view[$i1],$GUI_UNCHECKED)
Next
EndFunc
;实现默认选择功能
Func default_select1()
GUICtrlSetState($tab1button3,$GUI_DISABLE)
all_none1()
GUICtrlSetState($tab1_view[1],$GUI_CHECKED)
GUICtrlSetState($tab1_view[2],$GUI_CHECKED)
GUICtrlSetState($tab1_view[4],$GUI_CHECKED)
GUICtrlSetState($tab1_view[6],$GUI_CHECKED)
GUICtrlSetState($tab1button3,$GUI_ENABLE)
EndFunc
;tab1清理功能
Func clean1()
Check1()
select
Case $s1=$t1
MsgBox(0, "提示", "请选择要清理的项目!@_@")
Case $s1<$t1
GUICtrlSetState($tab1button4,$GUI_DISABLE)
For $i1=1 To $t1
If GUICtrlRead($Tab1_view[$i1]) =1 Or GUICtrlRead($Tab1_view[$i1])=257 Then
Call('Tab1_view'&$i1)
GUICtrlSetState('Tab1_view'&$i1,$GUI_DISABLE)
EndIf
GUICtrlSetData($progressbar1,100/25*$i1)
Next
MsgBox ( 0, "提示", "所选择的项目清理完毕!^_^")
GUICtrlSetData($progressbar1,0)
EndSelect
GUICtrlSetState($tab1button4,$GUI_ENABLE)
EndFunc
;检查用户是否没有选择任何选项,而直接点击清理的tab1
Func check1()
$s1=0
For $i1 =1 to $t1
If GUICtrlRead($Tab1_view[$i1])<>1 And GUICtrlRead($Tab1_view[$i1])<>257 Then $s1=$s1+1
Next
EndFunc
;实现全选功能tab2
Func all_select2()
GUICtrlSetState($tab2button1,$GUI_DISABLE)
For $i2 =1 to 12
GUICtrlSetState($tab2_view[$i2],$GUI_CHECKED)
Next
GUICtrlSetState($tab2button1,$GUI_ENABLE)
EndFunc
;实现全部不选功能tab2
Func all_none2()
For $i2 =1 to $t2
GUICtrlSetState($tab2_view[$i2],$GUI_UNCHECKED)
Next
EndFunc
;实现默认选择功能tab2
Func default_select2()
GUICtrlSetState($tab2button3,$GUI_DISABLE)
all_none2()
GUICtrlSetState($tab2_view[1],$GUI_CHECKED)
GUICtrlSetState($tab2_view[2],$GUI_CHECKED)
GUICtrlSetState($tab2_view[3],$GUI_CHECKED)
GUICtrlSetState($tab2_view[5],$GUI_CHECKED)
GUICtrlSetState($tab2_view[6],$GUI_CHECKED)
GUICtrlSetState($tab2_view[11],$GUI_CHECKED)
GUICtrlSetState($tab2_view[12],$GUI_CHECKED)
GUICtrlSetState($tab2button3,$GUI_ENABLE)
EndFunc
;清理开始tab2
Func clean2()
Check2()
select
Case $s2=$t2
MsgBox(0, "提示", "请选择要优化的项目!@_@")
Case $s2<$t2
GUICtrlSetState($tab2button4,$GUI_DISABLE)
For $i2=1 To $t2
If GUICtrlRead($Tab2_view[$i2]) = 1 Or GUICtrlRead($Tab2_view[$i2])=257 Then
Call('Tab2_view'&$i2)
EndIf
GUICtrlSetData($progressbar1,100/12*$i2)
Next
MsgBox ( 0, "提示", "所选择的项目优化完毕!^_^")
GUICtrlSetData($progressbar2,0)
EndSelect
GUICtrlSetState($tab2button4,$GUI_ENABLE)
EndFunc
;检查用户是否没有选择任何选项,而直接点击tab2的清理
Func check2()
$s2=0
For $i2 =1 to $t2
If GUICtrlRead($tab2_view[$i2])<>1 And GUICtrlRead($tab2_view[$i2])<>257 Then $s2=$s2+1
Next
EndFunc