|
楼主 |
发表于 2011-2-1 15:31:58
|
显示全部楼层
本帖最后由 stock128 于 2011-2-1 15:56 编辑
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=Run.ico
#AutoIt3Wrapper_OutFile=softinst.exe
#AutoIt3Wrapper_Res_Comment=by 3mile
#AutoIt3Wrapper_Res_Fileversion=0.0.0.12
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/striponly
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
;#include <IE.au3>
#include <GuiStatusBar.au3>
#include <array.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <SendMessage.au3>
;#NoTrayIcon
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1)
Opt("GUICloseOnESC", 1)
Opt("WinTitleMatchMode", 4)
#Region ### START Koda GUI section ### Form=d:\01.18传送\2.1\softins\form1.kxf
FileInstall("logo.jpg", @TempDir & "\logo.jpg", 1)
$ini_file = @ScriptDir & "\softinst.ini"
$version = "V1.0"
$Form1 = GUICreate("NTV软件自动安装工具" & $version, 833, 520, 190, 122)
$Pic1 = GUICtrlCreatePic(@TempDir & "\logo.jpg", 0, 0, 833, 110)
Local $aText[3] = [" " & @YEAR & "年" & @MON & "月" & @MDAY & "日", " 原型作者:3mile; 修改者:霹雳游侠", @HOUR & ":" & @MIN]
Local $aParts[3] = [180, 755, 100]
$hStatus = _GUICtrlStatusBar_Create($Form1, $aParts, $aText)
AdlibRegister("time", 10000)
Local $hImage[10], $listview[9], $Button[9], $a[9];, $ico[9]
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
For $p1 = 1 To 8
$listview[$p1] = GUICtrlCreateListView("软件名称|软件路径|软件描述", 154, 110, 680, 329, $LVS_ICON, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES))
_GUICtrlListView_SetColumnWidth($listview[$p1], 0, 250)
_GUICtrlListView_SetColumnWidth($listview[$p1], 1, 0)
_GUICtrlListView_SetColumnWidth($listview[$p1], 2, 400)
$ico = _GUIImageList_Create(1, 18)
_GUICtrlListView_SetImageList($listview[$p1], $ico, 1)
GUICtrlSetState($listview[$p1], $GUI_HIDE)
Next
$listview[0] = GUICtrlCreateListView("软件名称|软件路径|软件描述", 154, 110, 680, 329, $LVS_ICON, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES))
_GUICtrlListView_SetColumnWidth($listview[0], 0, 250)
_GUICtrlListView_SetColumnWidth($listview[0], 1, 0)
_GUICtrlListView_SetColumnWidth($listview[0], 2, 400)
$ico = _GUIImageList_Create(1, 18)
_GUICtrlListView_SetImageList($listview[0], $ico, 1)
Dim $high = 50, $shigh = 60, $all = IniReadSection($ini_file, "type")
;_ArrayDisplay($all)
For $p2 = 0 To 8
If $p2 = 0 Then
$Button[$p2] = GUICtrlCreateButton("全部软件", 10, Number($shigh + $high), 135, 36)
$hImage[0] = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon($hImage[0], @ScriptDir & "\SORT\" & $p2 & ".ico", 0, True)
_GUICtrlButton_SetImageList($Button[$p2], $hImage[0])
$shigh += 36
Else
$Button[$p2] = GUICtrlCreateButton($all[$p2][1], 10, Number($shigh + $high), 135, 36)
$hImage[0] = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon($hImage[0], @ScriptDir & "\SORT\" & $p2 & ".ico", 0, True)
_GUICtrlButton_SetImageList($Button[$p2], $hImage[0])
$shigh += 36
EndIf
Next
$progressbar = GUICtrlCreateProgress(10, 450, 270, 36)
$check_auto = GUICtrlCreateCheckbox("自动安装", 300, 450, 80, 36)
$wait = 0
If IniRead($ini_file, "Config", "Auto", 1) = 1 Then
AdlibRegister("pro1", 100)
GUICtrlSetState(-1, $GUI_CHECKED)
EndIf
$button_all = GUICtrlCreateButton("全选", 390, 450, 80, 36)
$button_no = GUICtrlCreateButton("全不选", 470, 450, 80, 36)
$button_chenge = GUICtrlCreateButton("反选", 550, 450, 80, 36)
$button_inst = GUICtrlCreateButton("手动安装所选软件", 650, 450, 120, 36, $BS_ICON)
GUICtrlCreateGroup("", -99, -99, 1, 1)
#EndRegion ### END Koda GUI section ###
all()
;GuiRegisterMsg($wm_Notify, "_wmNotify")
GUISetState(@SW_SHOW)
GUICtrlSetState($listview[1], $GUI_HIDE)
GUICtrlSetState($listview[0], $GUI_show)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button[0]
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
Sendmessig()
GUICtrlSetState($listview[0], $GUI_show)
Case $Button[1]
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
subsend()
GUICtrlSetState($listview[1], $GUI_show)
Case $Button[2]
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview[2], $GUI_show)
Case $Button[3]
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview[3], $GUI_show)
Case $Button[4]
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview[4], $GUI_show)
Case $Button[5]
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview[5], $GUI_show)
Case $Button[6]
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview[6], $GUI_show)
Case $Button[7]
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview[7], $GUI_show)
Case $Button[8]
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview[8], $GUI_show)
Case $button_all
$number = _GUICtrlListView_GetItemCount($listview[0])
For $m = 0 To $number - 1
_GUICtrlListView_SetItemChecked($listview[0], $m)
Next
subsend()
Case $button_no
$number = _GUICtrlListView_GetItemCount($listview[0])
For $m = 0 To $number - 1
_GUICtrlListView_SetItemChecked($listview[0], $m, False)
Next
subsend()
Case $button_chenge
$number = _GUICtrlListView_GetItemCount($listview[0])
For $m = 0 To $number - 1
$checked = _GUICtrlListView_GetItemChecked($listview[0], $m)
If $checked = True Then
_GUICtrlListView_SetItemChecked($listview[0], $m, False)
Else
_GUICtrlListView_SetItemChecked($listview[0], $m)
EndIf
Next
subsend()
Case $button_inst
Install()
Case $check_auto
AdlibUnRegister("pro1")
EndSwitch
WEnd
Func Install()
AdlibUnRegister("pro1")
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
Sendmessig()
GUICtrlSetState($listview[0], $GUI_show)
$ch_number = 0
$number = _GUICtrlListView_GetItemCount($listview[0])
For $m = 0 To $number - 1
$checked = _GUICtrlListView_GetItemChecked($listview[0], $m)
If $checked = True Then
$ch_number += 1
EndIf
Next
$n = 0
For $m = 0 To $number - 1
$checked = _GUICtrlListView_GetItemChecked($listview[0], $m)
If $checked = True Then
_GUICtrlListView_ClickItem($listview[0], $m)
If StringInStr(_GUICtrlListView_GetItemText($listview[0], $m, 1), " /") Or StringInStr(_GUICtrlListView_GetItemText($listview[0], $m, 1), " -") Then
$text = StringLower(_GUICtrlListView_GetItemText($listview[0], $m, 1))
$array = StringRegExp($text, "(.+.exe)(.+)", 1)
ShellExecuteWait($array[0], $array[1])
Else
ShellExecuteWait(_GUICtrlListView_GetItemText($listview[0], $m, 1))
EndIf
$n += 1
GUICtrlSetData($progressbar, Number(100 * ($n / $ch_number)))
EndIf
Next
MsgBox(0, "恭喜", "全部软件已经安装完成" & @CRLF & "程序将在5秒后关闭", 5)
Exit
EndFunc ;==>Install
Func all()
Dim $ico[9], $q[9]
$all = IniReadSection($ini_file, "type");返回"TYPE"类的数量
;_ArrayDisplay($all)
;_ArrayDisplay($all)
$ico1 = _GUIImageList_Create(32, 32, 5, 3);创建图标库
;For $e = 1 To $all[0][0]
$ico[1] = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico[2] = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico[3] = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico[4] = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico[5] = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico[6] = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico[7] = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico[8] = _GUIImageList_Create(32, 32, 5, 3);创建图标库
; MsgBox(0,0,$ico[$e])
;Next
For $do2 = 1 To $all[0][0];从1循环到总类别数量
$sub = IniReadSection($ini_file, $all[$do2][1] & ".list");读取分类数量
For $c = 1 To $sub[0][0];循环
$info1 = IniReadSection($ini_file, $sub[$c][1]);读取分类字段名
_GUIImageList_AddIcon($ico1, @ScriptDir & "\" & $info1[2][1], 0, True);增加图标
_GUIImageList_AddIcon($ico[1], @ScriptDir & "\" & $info1[2][1], 0, True);增加图标
_GUIImageList_AddIcon($ico[2], @ScriptDir & "\" & $info1[2][1], 0, True);增加图标
_GUIImageList_AddIcon($ico[3], @ScriptDir & "\" & $info1[2][1], 0, True);增加图标
_GUIImageList_AddIcon($ico[4], @ScriptDir & "\" & $info1[2][1], 0, True);增加图标
_GUIImageList_AddIcon($ico[5], @ScriptDir & "\" & $info1[2][1], 0, True);增加图标
_GUIImageList_AddIcon($ico[6], @ScriptDir & "\" & $info1[2][1], 0, True);增加图标
_GUIImageList_AddIcon($ico[7], @ScriptDir & "\" & $info1[2][1], 0, True);增加图标
_GUIImageList_AddIcon($ico[8], @ScriptDir & "\" & $info1[2][1], 0, True);增加图标
Next
Next
_GUICtrlListView_SetImageList($listview[0], $ico1, 1)
_GUICtrlListView_SetImageList($listview[1], $ico[1], 1)
_GUICtrlListView_SetImageList($listview[2], $ico[2], 1)
_GUICtrlListView_SetImageList($listview[3], $ico[3], 1)
_GUICtrlListView_SetImageList($listview[4], $ico[4], 1)
_GUICtrlListView_SetImageList($listview[5], $ico[5], 1)
_GUICtrlListView_SetImageList($listview[6], $ico[6], 1)
_GUICtrlListView_SetImageList($listview[7], $ico[7], 1)
_GUICtrlListView_SetImageList($listview[8], $ico[8], 1)
_GUICtrlListView_EnableGroupView($listview[0])
$q[0] = 0
$q[1] = 0
$q[2] = 0
$q[3] = 0
$q[4] = 0
$q[5] = 0
$q[6] = 0
$q[7] = 0
$q[8] = 0
For $do = 1 To $all[0][0]
_GUICtrlListView_InsertGroup($listview[0], -1, $do, $all[$do][1], 1)
$sub = IniReadSection($ini_file, $all[$do][1] & ".list")
;_ArrayDisplay($sub)
For $b = 1 To $sub[0][0]
_GUICtrlListView_AddItem($listview[0], $sub[$b][1], $q[0])
;_GUICtrlListView_SetImageList($ListView[0], $hImage[0], 1)
_GUICtrlListView_AddItem($listview[$do], $sub[$b][1], $q[$do])
$index = _GUICtrlListView_FindInText($listview[0], $sub[$b][1])
$index1 = _GUICtrlListView_FindInText($listview[$do], $sub[$b][1])
_GUICtrlListView_SetItemGroupID($listview[0], $index, $do)
;_GUICtrlListView_SetItemGroupID($listview[$do], $index1, $do)
$info = IniReadSection($ini_file, $sub[$b][1])
_GUICtrlListView_AddSubItem($listview[0], $index, @ScriptDir & "\" & $info[4][1], 1)
_GUICtrlListView_AddSubItem($listview[$do], $index1, @ScriptDir & "\" & $info[4][1], 1)
_GUICtrlListView_AddSubItem($listview[0], $index, $info[6][1], 2)
_GUICtrlListView_AddSubItem($listview[$do], $index1, $info[6][1], 2)
If $info[3][1] = 1 Then
_GUICtrlListView_SetItemChecked($listview[0], $index, True)
_GUICtrlListView_SetItemChecked($listview[$do], $index1, True)
EndIf
$q[0] += 1
$q[1] += 1
$q[2] += 1
$q[3] += 1
$q[4] += 1
$q[5] += 1
$q[6] += 1
$q[7] += 1
$q[8] += 1
Next
Next
EndFunc ;==>all
Func Sendmessig()
For $go = 1 To 8
$a[$go] = _GUICtrlListView_GetItemCount($listview[$go])
For $i = 0 To $a[$go] - 1
$Check = _GUICtrlListView_GetItemChecked($listview[$go], $i)
If $Check = True Then
$checked = _GUICtrlListView_GetItemText($listview[$go], $i)
$masterindex = _GUICtrlListView_FindInText($listview[0], $checked)
_GUICtrlListView_SetItemChecked($listview[0], $masterindex)
Else
$checked = _GUICtrlListView_GetItemText($listview[$go], $i)
$masterindex = _GUICtrlListView_FindInText($listview[0], $checked)
_GUICtrlListView_SetItemChecked($listview[0], $masterindex, False)
;$txit &= _GUICtrlListView_GetItemText($hListView, $i) & @CRLF
EndIf
Next
Next
EndFunc ;==>Sendmessig
Func subsend()
$number = _GUICtrlListView_GetItemCount($listview[0])
For $n = 0 To $number - 1
$lvstext = _GUICtrlListView_GetItemText($listview[0], $n)
$getgroup = _GUICtrlListView_GetItemGroupID($listview[0], $n)
$checked = _GUICtrlListView_GetItemChecked($listview[0], $n)
If $checked = True Then
$listindex = _GUICtrlListView_FindInText($listview[$getgroup], $lvstext)
_GUICtrlListView_SetItemChecked($listview[$getgroup], $listindex, True)
Else
$listindex = _GUICtrlListView_FindInText($listview[$getgroup], $lvstext)
_GUICtrlListView_SetItemChecked($listview[$getgroup], $listindex, False)
EndIf
Next
EndFunc ;==>subsend
Func time()
_GUICtrlStatusBar_SetText($hStatus, @HOUR & ":" & @MIN, 2)
EndFunc ;==>time
Func pro1()
GUICtrlSetData($progressbar, $wait)
$wait = $wait + 1
If $wait = 101 Then
Install()
EndIf
EndFunc ;==>pro1 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|