再来一个"给你参考"!有高手愿意帮忙指点斧正吗?!!
发 我的软件安装模板,作为再开版的小礼物!以前发过一个简易模板,小有点击量,此次作鸟大的修改!
有高手看鸟请帮忙指点斧正!!!!!!!
===================================
;整个脚本中的自定义变量不可随意修改!!!
;安装路径选择
For $i = 0 to 1
Global $var0
Assign("var0", "C")
$var1 = InputBox("路径选择", "开始 XX 的自动安装,请输入安装路径盘:","C", " M1")
If @error=1 Then
MsgBox(4096,"错误", "你点错按钮啦!")
Else
If $var1 = $var0 Then
$var2 = $var0
ElseIf $var1 <> $var0 Then
$var2 = $var1
EndIf
;检查指定驱动器是否存在
$i = FileExists($var2 & ":")
If $i = 0Then
MsgBox(16, "警告!", "所选驱动器不存在!重新操作!")
Else
EndIf
EndIf
Next
;检查目录是否存在
If FileExists($var2 & ":\Program Files") Then
Else
DirCreate($var2 & ":\Program Files")
EndIf
;=========================
$title=""
;运行 *.msi安装文件
Run("msiexec /i *.msi")
;运行 *.exe安装文件
Run("**.exe")
;====================
WinWaitActive($title, "开始安装")
ControlClick($title, "", "下一步按钮ID")
;====================
WinWaitActive($title, "许可协议")
ControlClick($title, "", "我同意控件ID")
ControlClick($title, "", "下一步按钮ID")
;====================
WinWaitActive($title, "继续安装")
ControlSetText($title, "", "注册控件ID1", "用户ID")
ControlSetText($title, "", "注册控件ID2", "第1注册码")
ControlSetText($title, "", "注册控件ID3", "第2注册码")
ControlSetText($title, "", "注册控件ID4", "第3注册码")
ControlSetText($title, "", "注册控件IDN", "第N注册码")
ControlClick($title, "", "下一步按钮ID")
;直接修改安装路径
;====================
WinWaitActive($title, "选择目标位置")
ControlClick($title, "选择目标位置", " 浏览按钮ID");用于页面路径框不能编辑时
If $var2 = $var0 Then
Else
$var3 = ControlGetText($title, "选择目标位置", "路径框ID")
$var4 = StringReplace ( $var3, 1, $var2 )
ControlSetText($title, "选择目标位置", "路径框ID", $var4 )
MsgBox(0, "$var4", $var4) ;调试时使用,正式脚本应删除此句
ControlClick($title, "浏览文件夹", "确定按钮ID");用于页面路径框不能编辑时
EndIf
ControlClick($title, "选择目标位置", "下一步按钮ID")
;=====================
WinWaitActive($title, "将安装")
ControlClick($title, "", "下一步按钮ID")
;====================
WinWaitActive($title, "选择附加任务")
;选中
ControlCommand($title,"", "组件ID", "Check", "")
;非选中
ControlCommand($title,"", "组件ID", "UnCheck", "")
ControlClick($title, "", "下一步按钮ID")
;====================
WinWaitActive($title, "准备安装")
ControlClick($title, "", "下一步按钮ID")
;====================
WinWaitActive($title, "安装完成")
ControlClick($title, "", "下一步按钮ID")
;====================
;关闭最后窗口
WinWait("窗口标题")
WinClose("窗口标题")
;====================
;关闭软件连接网页
ProcessWait("iexplore.exe")
ProcessClose("iexplore.exe")
$PID = ProcessExists("iexplore.exe")
If $PID Then ProcessClose($PID)
;====================
;一个控件多选项选择
WinWait($title,"")
If Not WinActivate($title,"") Then WinActivate($title,"")
WinWaitActive($title,"")
$WinPosArray = WinGetPos ($title)
$TNewCheckListBoxArray = ControlGetPos ( $title, "", "TNewCheckListBox1");"TNewCheckListBox1"=控件ID
$Width = $WinPosArray+$TNewCheckListBoxArray
$Height =$WinPosArray+$TNewCheckListBoxArray
MouseClick("left",$Width+20, $Height+50);第一个加数(20)修改鼠标左右座标;第2个加数(50)修改鼠标上下座标
MouseClick("left",$Width+20, $Height+70)
MouseClick("left",$Width+20, $Height+90)
MouseClick("left",$Width+20, $Height+110)
ControlClick($title, "", "下一步按钮ID")
;====================
;复制破解文件,以金山词霸2007为例:
FileCopy("Powerword2007.Crack\*.*", $var2 & ":\Program Files\Kingsoft\Powerword 2007",1)
FileCopy("Powerword2007.Crack\flw\*.*", $var2 & ":\Program Files\Kingsoft\Powerword 2007\flw",1)
FileCopy("Powerword2007.Crack\Language\*.*", $var2 & ":\Program Files\Kingsoft\Powerword 2007\Language",1)
;====================
;删除以破解工具自带的升级程序,以金山快译2007为例:
FileDelete($var2 & ":\Program Files\Kingsoft\FastAIT 2007\update.exe")
;====================
;安装结束提示
SplashTextOn("自动安装", "已完成 XX 的自动安装.", 250, 70, -1, -1, 0, "", 14)
Sleep(2000)
SplashOff()
Exit 很好,有一定的实用价值,收藏!:face (29): 前来支持一下 前来支持一下 前来支持一下 先看看。再来说明下。 :face (31):支持一下! 很好 很强大! 131738前辈,又学了你的大作。谢谢 很好,有一定的实用价值,收藏!:face (29):
bsplin 发表于 2008-5-4 06:59 http://www.autoitx.com/images/common/back.gif
我也是,帮楼主顶一下! 这儿au3高手好多,向你们学习,致敬! 真牛。。但是我太菜了。。不知道怎么使用。。。 很不错,支持楼主 看起来有点复杂,要好好学学了 顶了!!!!!!!!
页:
[1]
2