在机房管理中,有时需要对软件注册,而AutoDesk和Adobe的软件在注册时很蛋疼,每台机器都必须单独对软件进行注册,系统克隆和硬件同传系统是没用的,所以用AutoIT做了一个尝试,可以扩展到类似的软件注册过程中
#include <ie.au3>
Run("C:\\Program Files\\AutoCAD 2006\\acad.exe")
WinWaitActive("AutoCAD 2006 产品激活")
Send("{ENTER}")
_IELoadWait($oIE)
Sleep(5000)
;Get Request Code
$oIE=_IEAttach("现在注册","Embedded")
_IELoadWait($oIE)
$s=_IEBodyReadText($oIE)
$s=StringRegExpReplace($s,"(\r\n)"," ")
$s1=StringRegExp($s,"([\w\d]{4}\s[\w\d]{4}\s[\w\d]{4}\s[\w\d]{4}\s[\w\d]{4}\s[\w\d]{4}\s[\w\d]{4})",1)
if @error=0 Then
$requestCode=$s1[0]
Else
MsgBox(0,"","error")
EndIf
Send("{TAB}{DOWN}{TAB}{TAB}{TAB}{ENTER}")
_IELoadWait($oIE)
Sleep(5000)
Send("{DOWN}{TAB}")
;;run keygen and get authenticate code
Run("@keygen.exe")
WinWaitActive("Autodesk AutoCAD 2006 keygen by AGAIN")
Send($requestCode)
$AuthenticateCode=ControlGetText("Autodesk AutoCAD 2006 keygen by AGAIN","","Edit2")
WinClose("Autodesk AutoCAD 2006 keygen by AGAIN")
;;
WinActivate("AutoCAD 2006")
Send($AuthenticateCode)
Send("{TAB}{TAB}{Enter}")
_IELoadWait($oIE)
Sleep(1000)
Send("{TAB}{TAB}{TAB}{Enter}")
Sleep(30000)
WinClose("AutoCAD 2006")
为什么我用的时候提示:
回复删除_IELoadWait($oIE)
_IELoadWait(^ERROR
Error:使用了未经声明的变量.