AutoIT登录远程桌面

AutoIt3 01/06 阅读 12042 views次 人气 912
摘要:

在不区分版本和不考虑使用域用户登录的前提下,下述脚本可实现调用远程桌面并代填登录,若要使用程序调用,则需要把相应的参数传递给脚本即可。

Local $resIP,$resPort,$resAcc,$resPass
;-----------------------------------------
;test
$resIP='10.218.193.208'
$resPort='13389'
$resAcc='administrator'
$resPass='Ultr@power'
;-----------------------------------------
Func mstsc()
Run("mstsc")
If WinWaitActive("远程桌面连接","",5) Then
ControlClick("远程桌面连接","","ToolbarWindow321","")
Sleep(500)
ControlSetText("远程桌面连接","","Edit1",$resIP&':'&$resPort)
ControlSetText("远程桌面连接","","Edit2",$resAcc)
ControlClick("远程桌面连接","","Button13","")
If WinWaitActive($resIP&":"&$resPort&" - 远程桌面连接","",5) Then
Send($resPass,1)
Send("{enter}")
Else
MsgBox(1,"超时","连接失败,请确认网络是否通畅,端口是否正确等")
EndIf
Else
MsgBox(1,"超时","请确认本机是否安装了远程桌面功能")
EndIf
EndFunc

mstsc()
 

评论

该文章不支持评论!

分享到: