我想用sendkeys方法启用mstsc.exe然后登录远程。
登录的过程是先点击“远程登录界面1”的选项按钮,然后在“远程登录界面2”中进行用户名、密码的输入。
可问题是当运行到WshShell.SendKeys " ~"语句时程序并没有执行,也就是并没有模拟回车打开选项按钮,请教这是为什么?- Dim WshShell
- set WshShell = CreateObject("wscript.Shell")
- WshShell.Run "mstsc.exe"
- WScript.Sleep 2000
- WshShell.SendKeys "{tab 4}"
- WshShell.SendKeys " ~"
- WScript.Sleep 2000
- WshShell.SendKeys "{tab}"
- WshShell.SendKeys "{tab}"
- WshShell.SendKeys "10.888.888.8"
- WshShell.SendKeys "{tab}"
- WshShell.SendKeys "user"
- WshShell.SendKeys "{tab}"
- WshShell.SendKeys "password"
- WshShell.SendKeys "{tab 5}"
- WshShell.SendKeys "{enter}"
复制代码
|