|
发表于 2009-5-26 19:28:51
|
显示全部楼层
本帖最后由 zyx870615 于 2009-5-26 19:34 编辑
看我的呢.
Func programelist($filename)
$filename="["&$filename&"]"
$file = FileOpen("programelist.dat", 0)
If $file = -1 Then
MsgBox(0, "RHT提醒你", "无法读取程序位置信息,请确认当前目录下是否有 programelist.dat文件。")
Exit
EndIf
$linesum=1
While 1
$programelist=FileReadLine($file, $linesum)
If @error = -1 Then ExitLoop
$linesum=$linesum+1
Wend
For $line=1 To $linesum-1
If($filename=FileReadLine($file, $line)) Then
$programelist=FileReadLine($file, $line+1)
EndIf
Next
FileClose($file)
Return($programelist)
EndFunc
前面的不用看,其实只是一个小函数,从当前目录中的programelist.dat文件中读取安装位置,这样更便于安装位置的设置.适合更多的不同人使用.
Opt("TrayIconHide",1)
Opt("WinTitleMatchMode",4)
Run("QQ2009_chs.exe")
WinWaitActive("腾讯QQ2009 安装向导","我已阅读并同意软件许可协议和青少年上网安全指导")
ControlClick("last","","我已阅读并同意软件许可协议和青少年上网安全指导","left")
Send("!N")
WinWaitActive("腾讯QQ2009 安装向导","自定义安装选项")
ControlClick("last","","将浏览器的首页设置为QQ.com","left")
ControlClick("last","","安装腾讯软件管理器","left")
ControlClick("last","","安装QQ工具栏","left")
ControlClick("last","","安装中文搜搜","left")
Send("!N")
WinWaitActive("腾讯QQ2009 安装向导","请选择安装路径")
ControlSetText("last","","Edit1",programelist("QQ2009"))
Send("!I")
WinWaitActive("腾讯QQ2009 安装向导","安装完成")
ControlClick("last","","立即运行腾讯QQ2009","left")
ControlClick("last","","显示新特性","left")
ControlClick("last","","开机时启动腾讯QQ2009","left")
Send("!F")
$time=0
While ProcessExists("StorageTool.exe")=0
If $time <= 15000 Then
sleep(250)
$time=$time+250
Else
Exit
EndIf
WEnd
WinWaitActive("QQ数据迁移")
Send("{Enter}")
最后这个WHILE判断10S,如果10秒内没有QQ数据迁移的进程出现,则自动退出程序,若出现此进程,则等待它完成操作后按回车退出.
LZ指正. |
|