#RequireAdmin
#NoTrayIcon
Run("C盘保护.exe")
$title="Returnil Virtual System Personal Edition 安装向导"
WinWait($title,"欢迎使用Returnil Virtual System Personal Edition 安装向导")
WinActivate($ti ...
小军218 发表于 2009-7-4 14:05
顺便公开下本人的源代码:
#ce _______________脚本开始_________________
Opt('WinTitleMatchMode',4)
Opt('TrayIconDeBug',1)
$Title = 'Returnil Virtual System Personal Edition 安装向导'
Run('C盘保护.eXe')
Winwait($Title,'使用帮助')
ControlClick($Title,'使用帮助','[Text:下一步 >]')
WinWait($Title,'TabLicense')
ControlClick($Title,'TabLicense','[Text:接受]')
$Path = 'D:\Program files\Returnil\' ; 用户指定程序安装路径
WinWait($Title,'TabDirectory')
WinActivate($Title,'TabDirectory')
$TagDir = ControlgetText($Title,'TabDirectory','TEdit1')
If FileExists($TagDir) Then DirRemove($TagDir,1)
; ControlSetText($Title,'TabDirectory','TEdit1',$Path)
ControlClick($Title,'TabDirectory','[Text:下一步 >]')
$SerialNum = 'D53A1A0C7A426B8EBC95AFF7B1B79D7B' ; 如果还有其他序列号的话, 请在此指定
WinWait($Title,'TabRegister')
WinActivate($Title,'TabRegister')
; ControlSetText($Title,'TabRegister',$SerialNum)
ControlClick($Title,'TabRegister','[Text:下一步 >]')
$PwdMsg = MsgBox(308+262144,' 需要输入密码保护吗?','如果需要设置密码, 请点【是】,否则请单击【否】',8)
If $PwdMsg = 7 Or $PwdMsg = -1 Then
_Next()
Else
$Pwd = InputBox('请输入密码','请输入您想要的密码','','*',12,35)
While 1
If $Pwd <> '' Then
MsgBox(64+262144,'您的密码是:','您设置的密码是: '&@Cr&$Pwd&@Cr& '请牢牢记住啦!')
_PwdNext()
ExitLoop
Else
If MsgBox(36+262144,'您还没有输入密码:','您还没有输入密码! 是否返回重新输入...',5) = 7 Then
_Next()
ExitLoop
Else
$Pwd = InputBox('请输入密码','请输入您想要设置的密码','','*',12,35)
EndIf
EndIf
WEnd
EndIf
Func _PwdNext()
WinWait($Title,'TabAddition')
WinActivate($Title,'TabAddition')
ControlCommand($Title,'TabAddition','[Text:使用密码来保护程序]','Check')
WinActivate($Title,'TabAddition')
ControlSetText($Title,'TabAddition','TEdit1',$Pwd)
WinActivate($Title,'TabAddition')
ControlSetText($Title,'TabAddition','TEdit2',$Pwd)
WinActivate($Title,'TabAddition')
ControlCommand($Title,'TabAddition','[Text:设置对系统分区 C: 的工作状态为保护]','Check')
ControlClick($Title,'TabAddition','[Text:下一步 >]')
EndFunc
Func _Next()
WinWait($Title,'TabAddition')
WinActivate($Title,'TabAddition')
ControlCommand($Title,'TabAddition','[Text:使用密码来保护程序]','UnCheck')
WinActivate($Title,'TabAddition')
ControlCommand($Title,'TabAddition','[Text:设置对系统分区 C: 的工作状态为保护]','Check')
ControlClick($Title,'TabAddition','[Text:下一步 >]')
EndFunc
WinWait($Title,'TabCopy')
ControlClick($Title,'TabCopy','[Text:安装]')
WinWait($Title,'TabReboot')
WinActivate($Title,'TabReboot')
ControlCommand($Title,'TabReboot','[Text:稍后再重新启动.]','Check')
ControlClick($Title,'TabReboot','[Text:完成]')
; 说明: 本人使用了单击按钮文本的方法, 就是说不管按钮的 ID 如何变化, 只要文本不变就行!
; 以上代码经测试可行(测试环境: Windows XP SP3 中文版, 其他操作系统没试过...) |