本帖最后由 fuldho 于 2011-7-17 12:32 编辑
基于AU3制作程序安装包----例子源码及所需文件
首先把安装文件7Z打包,在完全基于AU3编程制作,
这只是一个例子,很简单,扩展空间很大。
有兴趣的可以试试。
- #NoTrayIcon
- #Region ;**** 参数创建于 ACNWrapper_GUI ****
- #AutoIt3Wrapper_Icon=LOGO.ico
- #AutoIt3Wrapper_Outfile=FSCapture.exe
- #AutoIt3Wrapper_Compression=4
- #AutoIt3Wrapper_UseUpx=n
- #AutoIt3Wrapper_Res_Description=截图工具安装程序
- #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
- #AutoIt3Wrapper_Res_LegalCopyright=@copyright 2011
- #AutoIt3Wrapper_Res_Field=CompanyName|年老痴呆制作
- #AutoIt3Wrapper_Run_Tidy=y
- #EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
- #include <ButtonConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- #include <Misc.au3>
- #include <ComboConstants.au3>
- #include <GUIListView.au3>
- #include <ListViewConstants.au3>
- #Region ### START Koda GUI section ### Form=
- $Form1 = GUICreate("FSCapture程序安装", 510, 315, -1, -1)
- FileInstall("logo.jpg", @TempDir & "")
- $Pic1 = GUICtrlCreatePic(@TempDir & "\logo.jpg", 0, 0, 164, 314, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
- FileDelete(@TempDir & "\logo.jpg")
- $Input1 = GUICtrlCreateInput("", 180, 258, 220, 20)
- $Group1 = GUICtrlCreateGroup("安装许可协议:", 180, 35, 320, 195)
- $Label1 = GUICtrlCreateLabel(" 我的许可协议很苛刻!你能接受吗?" & @CRLF & @CRLF & "你要安装必须付款,先给钱后安装,我这人就爱钱," & @CRLF & @CRLF & "给钱!给钱!快给钱吧!!!", 200, 70, 280, 140)
- ;这里写入协议内容
- $Button1 = GUICtrlCreateButton("安装目录(&C)", 405, 255, 100, 25)
- GUICtrlSetState($Button1, $GUI_DISABLE)
- $Button2 = GUICtrlCreateButton("执行安装(&I)", 405, 285, 100, 25)
- GUICtrlSetState($Button2, $GUI_DISABLE)
- $Ag = GUICtrlCreateCheckbox("我同意许可协议", 190, 236, 100, 20)
- GUICtrlSetState(-1, $GUI_UNCHECKED)
- $QQ = GUICtrlCreateLabel("WWW.www.ampc8.com/ 程序:年老痴呆", 180, 292, 210, 20)
- GUICtrlSetColor(-1, 0x008000)
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- FileInstall("7za.exe", @TempDir & "", 1)
- ;装入7za.exe,用于解压安装包。
- FileInstall("7.7z", @TempDir & "", 1)
- ;装入7.7z,7.7z是已经用7z压缩的预安装程序。
- While 1
- $nMsg = GUIGetMsg()
- Select
- Case $nMsg = $GUI_EVENT_CLOSE
- FileDelete(@TempDir & "\7za.exe")
- FileDelete(@TempDir & "\7.7z")
- Exit
- Case $nMsg = $Ag
- If GUICtrlRead($Ag) = $GUI_CHECKED Then
- GUICtrlSetState($Button1, $GUI_ENABLE)
- EndIf
- If GUICtrlRead($Ag) = $GUI_UNCHECKED Then
- GUICtrlSetState($Button1, $GUI_DISABLE)
- ;这里调整控件状态。
- EndIf
- Case $nMsg = $Button1
- $Search = FileSelectFolder("请选择一个文件夹:", "")
- ;这里选择安装目录。
- $Preservation = GUICtrlSetData($Input1, $Search)
- If StringLen(GUICtrlRead($Input1)) >= 1 Then
- GUICtrlSetState($Button2, $GUI_ENABLE)
- EndIf
- Case $nMsg = $Button2
- RunWait(@TempDir & "\7za.exe" & " x " & @TempDir & "\7.7z" & " -y -o" & $Search, @WindowsDir, @SW_HIDE)
- ;解压预安装文件到安装目录。
- FileCreateShortcut($Search & "\fsc\FSCapture.exe", @DesktopDir & "\FSCapture.exe.lnk", " ", " ", "描叙", $Search & "\fsc\FSCapture.exe", " ", "0", @SW_MINIMIZE)
- ;创建桌面快捷方式,程序在子文件夹时要写子文件夹路径。
- FileCreateShortcut($Search & "\fsc\FSCapture.exe", @ProgramsDir & "\FSCapture.exe.lnk", " ", " ", "描叙", $Search & "\fsc\FSCapture.exe", " ", "0", @SW_MINIMIZE)
- ;创建开始快捷方式,程序在子文件夹时要写子文件夹路径。
- Run($Search & "\fsc\FSCapture.exe ")
- ;这里用于安装完成要运行的程序,如:注册组件、主程序等,(组件注册请用"RunWait"等待模式)。
- FileDelete(@TempDir & "\7za.exe")
- FileDelete(@TempDir & "\7.7z")
- If FileExists(@TempDir & "\7.7z") = 0 Then
- ;这里判断程序包是否存在来判断安装完成。
- MsgBox(0, "完成", "安装完成 !")
- Exit
- EndIf
- EndSelect
- WEnd
复制代码
所需文件及制作好的FSCapture.exe安装包例子
游客 你好,作者设置隐藏了部分内容, 请回复讨论才可查看 |