软件自动安装 源代码 求大神看看
本帖最后由 gongbogw 于 2015-9-18 16:17 编辑#region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=tubiao.ico
#PRE_Outfile=SoftMgr.exe
#PRE_Res_Comment=软件自选安装器
#PRE_Res_Fileversion=1.0.10.6
#PRE_Res_Fileversion_AutoIncrement=y
#PRE_Res_requestedExecutionLevel=None
#PRE_Run_Tidy=y
#PRE_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 & "\config.ini"
$version = "V1.0"
$Form1 = GUICreate("软件自选安装器" & $version, 800, 520, 100, 100)
$Pic1 = GUICtrlCreatePic(@TempDir & "\logo.jpg", 0, 0, 800, 100)
Local $aText = [" " & @YEAR & "年" & @MON & "月" & @MDAY & "日", " 某某设计制作", @HOUR & ":" & @MIN]
Local $aParts =
$hStatus = _GUICtrlStatusBar_Create($Form1, $aParts, $aText)
AdlibRegister("time", 10000)
Local $hImage, $listview, $Button, $a;, $ico
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 = GUICtrlCreateListView("软件名称|软件路径|软件描述", 154, 110, 680, 329, $LVS_ICON, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES))
_GUICtrlListView_SetColumnWidth($listview, 0, 250)
_GUICtrlListView_SetColumnWidth($listview, 1, 0)
_GUICtrlListView_SetColumnWidth($listview, 2, 400)
$ico = _GUIImageList_Create(1, 18)
_GUICtrlListView_SetImageList($listview, $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 = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon($hImage, @ScriptDir & "\SORT\" & $p2 & ".ico", 0, True)
_GUICtrlButton_SetImageList($Button[$p2], $hImage)
$shigh += 36
Else
$Button[$p2] = GUICtrlCreateButton($all[$p2], 10, Number($shigh + $high), 135, 36)
$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon($hImage, @ScriptDir & "\SORT\" & $p2 & ".ico", 0, True)
_GUICtrlButton_SetImageList($Button[$p2], $hImage)
$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, $GUI_HIDE)
GUICtrlSetState($listview, $GUI_show)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
Sendmessig()
GUICtrlSetState($listview, $GUI_show)
Case $Button
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
subsend()
GUICtrlSetState($listview, $GUI_show)
Case $Button
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview, $GUI_show)
Case $Button
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview, $GUI_show)
Case $Button
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview, $GUI_show)
Case $Button
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview, $GUI_show)
Case $Button
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview, $GUI_show)
Case $Button
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview, $GUI_show)
Case $Button
For $bu = 0 To 8
GUICtrlSetState($listview[$bu], $GUI_HIDE)
Next
;subsend()
GUICtrlSetState($listview, $GUI_show)
Case $button_all
$number = _GUICtrlListView_GetItemCount($listview)
For $m = 0 To $number - 1
_GUICtrlListView_SetItemChecked($listview, $m)
Next
subsend()
Case $button_no
$number = _GUICtrlListView_GetItemCount($listview)
For $m = 0 To $number - 1
_GUICtrlListView_SetItemChecked($listview, $m, False)
Next
subsend()
Case $button_chenge
$number = _GUICtrlListView_GetItemCount($listview)
For $m = 0 To $number - 1
$checked = _GUICtrlListView_GetItemChecked($listview, $m)
If $checked = True Then
_GUICtrlListView_SetItemChecked($listview, $m, False)
Else
_GUICtrlListView_SetItemChecked($listview, $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, $GUI_show)
$ch_number = 0
$number = _GUICtrlListView_GetItemCount($listview)
For $m = 0 To $number - 1
$checked = _GUICtrlListView_GetItemChecked($listview, $m)
If $checked = True Then
$ch_number += 1
EndIf
Next
$n = 0
For $m = 0 To $number - 1
$checked = _GUICtrlListView_GetItemChecked($listview, $m)
If $checked = True Then
_GUICtrlListView_ClickItem($listview, $m)
If StringInStr(_GUICtrlListView_GetItemText($listview, $m, 1), " /") Or StringInStr(_GUICtrlListView_GetItemText($listview, $m, 1), " -") Then
$text = StringLower(_GUICtrlListView_GetItemText($listview, $m, 1))
$array = StringRegExp($text, "(.+.exe)(.+)", 1)
ShellExecuteWait($array, $array)
Else
ShellExecuteWait(_GUICtrlListView_GetItemText($listview, $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, $q
$all = IniReadSection($ini_file, "type");返回"TYPE"类的数量
;_ArrayDisplay($all)
;_ArrayDisplay($all)
$ico1 = _GUIImageList_Create(32, 32, 5, 3);创建图标库
;For $e = 1 To $all
$ico = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico = _GUIImageList_Create(32, 32, 5, 3);创建图标库
$ico = _GUIImageList_Create(32, 32, 5, 3);创建图标库
; MsgBox(0,0,$ico[$e])
;Next
For $do2 = 1 To $all;从1循环到总类别数量
$sub = IniReadSection($ini_file, $all[$do2] & ".list");读取分类数量
For $c = 1 To $sub;循环
$info1 = IniReadSection($ini_file, $sub[$c]);读取分类字段名
_GUIImageList_AddIcon($ico1, @ScriptDir & "\" & $info1, 0, True);增加图标
_GUIImageList_AddIcon($ico, @ScriptDir & "\" & $info1, 0, True);增加图标
_GUIImageList_AddIcon($ico, @ScriptDir & "\" & $info1, 0, True);增加图标
_GUIImageList_AddIcon($ico, @ScriptDir & "\" & $info1, 0, True);增加图标
_GUIImageList_AddIcon($ico, @ScriptDir & "\" & $info1, 0, True);增加图标
_GUIImageList_AddIcon($ico, @ScriptDir & "\" & $info1, 0, True);增加图标
_GUIImageList_AddIcon($ico, @ScriptDir & "\" & $info1, 0, True);增加图标
_GUIImageList_AddIcon($ico, @ScriptDir & "\" & $info1, 0, True);增加图标
_GUIImageList_AddIcon($ico, @ScriptDir & "\" & $info1, 0, True);增加图标
Next
Next
_GUICtrlListView_SetImageList($listview, $ico1, 1)
_GUICtrlListView_SetImageList($listview, $ico, 1)
_GUICtrlListView_SetImageList($listview, $ico, 1)
_GUICtrlListView_SetImageList($listview, $ico, 1)
_GUICtrlListView_SetImageList($listview, $ico, 1)
_GUICtrlListView_SetImageList($listview, $ico, 1)
_GUICtrlListView_SetImageList($listview, $ico, 1)
_GUICtrlListView_SetImageList($listview, $ico, 1)
_GUICtrlListView_SetImageList($listview, $ico, 1)
_GUICtrlListView_EnableGroupView($listview)
$q = 0
$q = 0
$q = 0
$q = 0
$q = 0
$q = 0
$q = 0
$q = 0
$q = 0
For $do = 1 To $all
_GUICtrlListView_InsertGroup($listview, -1, $do, $all[$do], 1)
$sub = IniReadSection($ini_file, $all[$do] & ".list")
;_ArrayDisplay($sub)
For $b = 1 To $sub
_GUICtrlListView_AddItem($listview, $sub[$b], $q)
;_GUICtrlListView_SetImageList($ListView, $hImage, 1)
_GUICtrlListView_AddItem($listview[$do], $sub[$b], $q[$do])
$index = _GUICtrlListView_FindInText($listview, $sub[$b])
$index1 = _GUICtrlListView_FindInText($listview[$do], $sub[$b])
_GUICtrlListView_SetItemGroupID($listview, $index, $do)
;_GUICtrlListView_SetItemGroupID($listview[$do], $index1, $do)
$info = IniReadSection($ini_file, $sub[$b])
_GUICtrlListView_AddSubItem($listview, $index, @ScriptDir & "\" & $info, 1)
_GUICtrlListView_AddSubItem($listview[$do], $index1, @ScriptDir & "\" & $info, 1)
_GUICtrlListView_AddSubItem($listview, $index, $info, 2)
_GUICtrlListView_AddSubItem($listview[$do], $index1, $info, 2)
If $info = 1 Then
_GUICtrlListView_SetItemChecked($listview, $index, True)
_GUICtrlListView_SetItemChecked($listview[$do], $index1, True)
EndIf
$q += 1
$q += 1
$q += 1
$q += 1
$q += 1
$q += 1
$q += 1
$q += 1
$q += 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, $checked)
_GUICtrlListView_SetItemChecked($listview, $masterindex)
Else
$checked = _GUICtrlListView_GetItemText($listview[$go], $i)
$masterindex = _GUICtrlListView_FindInText($listview, $checked)
_GUICtrlListView_SetItemChecked($listview, $masterindex, False)
;$txit &= _GUICtrlListView_GetItemText($hListView, $i) & @CRLF
EndIf
Next
Next
EndFunc ;==>Sendmessig
Func subsend()
$number = _GUICtrlListView_GetItemCount($listview)
For $n = 0 To $number - 1
$lvstext = _GUICtrlListView_GetItemText($listview, $n)
$getgroup = _GUICtrlListView_GetItemGroupID($listview, $n)
$checked = _GUICtrlListView_GetItemChecked($listview, $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 求大神看看如何去掉左下角进度条? 求大神看看如何去掉左下角进度条? 大神们快来 回复 4# gongbogw
如何去掉左下角进度条呢? $progressbar = GUICtrlCreateProgress(10, 450, 270, 36)
这一条就是进度条,找到相关的代码删除应该就行了... $progressbar = GUICtrlCreateProgress(10, 450, 270, 36)
这一条就是进度条,找到相关的代码删除应该就行了... 有进度条也挺好的啊,。不失美观。 回复 2# gongbogw
楼上正确
搜索“GUICtrlSetData($progressbar”
删除
1:$progressbar = GUICtrlCreateProgress(10, 450, 270, 36)
2:GUICtrlSetData($progressbar, Number(100 * ($n / $ch_number)))
3:GUICtrlSetData($progressbar, $wait) 回复 1# gongbogw
怪事,我怎么编译不了?
config.ini是如何写的?跟config.ini有关系吗? 源码分享下啊 感謝大大分享 进度条是亮点,能倒计时,还能提示安装进度。只有日期中的时间是多余的。
希望能公开源代码。不是修改后的。 在$progressbar = GUICtrlCreateProgress(10, 450, 270, 36)下面
加上GUICtrlSetState(-1, $GUI_DISABLE) 是最简单的去掉进度条的方法 不错,学习了!!{:face (356):}
页:
[1]
2