本帖最后由 xms77 于 2011-10-1 21:40 编辑
回复 7# txbihai
借鉴我的代码试试,使用窗口句柄的好处是不管窗口有没有激活,用命名,密码和确认键发送不会出错。Run("C:\Program Files\RealVNC\VNC4\vncviewer.exe","",@SW_HIDE)
$Whandle = WinGetHandle("VNC Viewer : Connection Details")
Sleep(200)
ControlSetText($Whandle,"","Edit1",$iIP)
Sleep(200)
ControlClick($Whandle,"","Button3","left")
Sleep(200)
WinExists("VNC Viewer : Authentication [No Encryption]")
$Whandle1 = WinGetHandle("VNC Viewer : Authentication [No Encryption]")
Sleep(200)
ControlSetText($Whandle1,"","Edit2","123") ;输入密码123
Sleep(200)
ControlClick($Whandle1,"","Button1","left") ;鼠标左击OK按钮
WinSetState($Whandle1,"",@SW_SHOW)
|