请问如何将脚本和安装程序二合一?
我通常把安装脚本直接转成 EXE文件,并把安装程序放到同一文件夹下,但是这样有很多问题,看过其他人的就直接一个安程程序能自动安装,不知是怎样做的,请知道的兄弟讲一下 具体我也想知道,但我想用7--z生成自解压工具包,然后在脚步中设置删除临时文件就可以了。我也是菜鸟,不对之处请指点,呵呵 多谢楼上的兄弟,希望不是自解压吧,若果安装程序几百M,不就.....................:face (18): FileInstall() 楼上的兄弟,能否讲得详细一些,能否贴个例子就更好了:face (29): 用fileinstall如何在脚本中判断解压完毕才执行下一个脚本? 等待N人解答!
刚接触AU!! 我是新手,有个笨方法
把脚本和文件做成一个自解压包,在自解压包选项设定里有,解压完成后执行文件这一项,里面填上服本的文件名,就可以了
7z和winrar都用过,可以正常运行 参考下,我这个WINRAR的自动安装及常用设置吧
只要把文件放在和脚本同目录就行
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=..\..\图标工具\ico\winrar.ico
#AutoIt3Wrapper_outfile=E:\winrar.exe
#AutoIt3Wrapper_Res_Comment=WinRAR 3.80正式版,根据个人喜好安装设置
#AutoIt3Wrapper_Res_Description=(C) 2008 by Iceの青
#AutoIt3Wrapper_Res_Fileversion=1.1.9.9
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=Iceの青
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
FileInstall("WinRAR_3.80.exe", @TempDir & "\")
RUN(@TempDir&"\WinRAR_3.80.exe")
WinWaitActive("WinRAR","版权所有")
ControlClick("WinRAR","版权所有","Button2")
WinWaitActive("WinRAR","关联")
ControlClick("WinRAR","关联","Button16")
ControlCommand("WinRAR", "关联","Button13", "UnCheck", "")
ControlCommand("WinRAR", "关联","Button14", "UnCheck", "")
ControlCommand("WinRAR", "关联","Button18", "UnCheck", "")
ControlCommand("WinRAR", "关联","Button19", "UnCheck", "")
ControlCommand("WinRAR", "关联","Button20", "UnCheck", "")
ControlCommand("WinRAR", "关联","Button21", "Check", "")
ControlCommand("WinRAR", "关联","Button23", "Check", "")
ControlCommand("WinRAR", "关联","Button24", "Check", "")
ControlClick("WinRAR","关联","Button25")
WinWaitActive("关联菜单项目","选择")
ControlCommand("关联", "选择","Button2", "Check", "")
ControlCommand("关联", "选择","Button3", "Check", "")
ControlCommand("关联", "选择","Button4", "UnCheck", "")
ControlCommand("关联", "选择","Button5", "UnCheck", "")
ControlCommand("关联", "选择","Button6", "Check", "")
ControlCommand("关联", "选择","Button7", "Check", "")
ControlCommand("关联", "选择","Button8", "UnCheck", "")
ControlCommand("关联", "选择","Button9", "UnCheck", "")
ControlCommand("关联", "选择","Button10", "UnCheck", "")
ControlCommand("关联", "选择","Button11", "UnCheck", "")
ControlCommand("关联", "选择","Button12", "UnCheck", "")
ControlClick("关联菜单项目","选择","Button13")
ControlClick("WinRAR","关联","Button27")
WinWaitActive("WinRAR","成功")
ControlClick("WinRAR","成功","Button1")
FileDelete(@TempDir & "\WinRAR_3.80.exe") FileInstall("UltraISO.exe", @TempDir & "\UltraISO.exe") ;将UltraISO.exe包装到程序中并运行时UltraISO.exe释放到临时文件夹
RunWait(@TempDir & "\UltraISO.exe") ;运行UltraISO.exe文件
If ProcessWaitClose(@TempDir& "\UltraISO.exe") Then
FileDelete(@TempDir & "\UltraISO.exe") ;如果UltraISO.exe文件被关闭则删除UltraISO.exe文件,就是说UltraISO.exe文件运行完了以后就删除UltraISO.exe文件。
EndIf结束该段执行脚本
因为防止新手不是很了解就用通俗语言讲了,不到之处还请谅解。
[ 本帖最后由 sunwei4616 于 2008-10-30 16:04 编辑 ] 例子:
#NoTrayIcon
#Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=xpset\24.ico
#AutoIt3Wrapper_outfile=1.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Allow_Decompile=n
#AutoIt3Wrapper_Res_Comment=系统垃圾清理 V1.21
#AutoIt3Wrapper_Res_Description=系统垃圾清理 V1.21
#AutoIt3Wrapper_Res_Fileversion=1.2.1.0
#AutoIt3Wrapper_Res_LegalCopyright=版权所有(C)2002-2008 没有
#AutoIt3Wrapper_Res_Field=QQ/TM|还没有申请
#AutoIt3Wrapper_Res_Field=QQ群|申请不到
#AutoIt3Wrapper_Res_Field=软件网站|太费钱
#AutoIt3Wrapper_Res_Field=作者:|就是我自己
#AutoIt3Wrapper_Res_Field=产品版本|1.2.1.0
#AutoIt3Wrapper_Res_Field=产品名称|系统垃圾清理 V1.21
#AutoIt3Wrapper_Res_Field=内部说明|系统垃圾清理 V1.21
#AutoIt3Wrapper_Res_Field=公司|明天注册个
#AutoIt3Wrapper_Res_Field=合法商标|后天注册个
#AutoIt3Wrapper_Res_Field=内部名称|系统垃圾清理.exe
#AutoIt3Wrapper_Res_Field=源文件名|系统垃圾清理
#EndRegion ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#Region
#EndRegion
Func _ProcessGetName($i_PID)
If Not ProcessExists($i_PID) Then
SetError(1)
Return ''
EndIf
Local $a_Processes = ProcessList()
If Not @error Then
For $i = 1 To $a_Processes
If $a_Processes[$i] = $i_PID Then Return $a_Processes[$i]
Next
EndIf
SetError(1)
Return ''
EndFunc
Func _ProcessGetPriority($vProcess)
Local $i_PID = ProcessExists($vProcess)
If Not $i_PID Then
SetError(1)
Return -1
EndIf
Local $hDLL = DllOpen('kernel32.dll')
Local $aProcessHandle = DllCall($hDLL, 'int', 'OpenProcess', 'int', 0x0400, 'int', False, 'int', $i_PID)
Local $aPriority = DllCall($hDLL, 'int', 'GetPriorityClass', 'int', $aProcessHandle)
DllCall($hDLL, 'int', 'CloseHandle', 'int', $aProcessHandle)
DllClose($hDLL)
Switch $aPriority
Case 0x00000040
Return 0
Case 0x00004000
Return 1
Case 0x00000020
Return 2
Case 0x00008000
Return 3
Case 0x00000080
Return 4
Case 0x00000100
Return 5
Case Else
SetError(1)
Return -1
EndSwitch
EndFunc
Func _RunDOS($sCommand)
Return RunWait(@ComSpec & " /C " & $sCommand, "", @SW_HIDE)
EndFunc
; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-END: D:\DOWNLOADS\3.2.4.9.1\Include\process.au3>
; ----------------------------------------------------------------------------
FileInstall("KKClean.dll", @SystemDir & "\")
_RunDOS("rundll32 KKClean.dll,ClearSys")
If ProcessWaitClose(@SystemDir & "\KKClean.dll") Then
FileDelete(@SystemDir & "\KKClean.dll")
EndIf
; ----------------------------------------------------------------------------
; <AUT2EXE INCLUDE-END: C:\Documents and Settings\Administrator\桌面\invoke.au3>
; ---------------------------------------------------------------------------- 后面的有些看不懂…… 都不怎么懂 ,慢慢来吧,总友一天会懂得,感谢那些发脚本得朋友们。 七巧通了六巧 自动解压很简单的呀,其实在高级里面有个自解压选项,选项里面的常规里面有解压路径设置好,下面就是安装程序,
看了你的以后,解压后运行set.au3就可以了呀,解压后自动运行这个程序了.
页:
[1]
2