现在的位置: 首页 > 综合 > 正文

qtp之键盘操作

2013年08月10日 ⁄ 综合 ⁄ 共 713字 ⁄ 字号 评论关闭

'************************************************************************************************
'键盘操作
'*************************************************************************************************
Dim WshShell
SystemUtil.Run "C:\WINDOWS\system32\notepad.exe","","C:\Documents and Settings\Administrator","open"
Set WshShell = CreateObject("WScript.Shell")  '创建WScript.Shell对象
Window("记事本").Activate '激活当前的记事本窗口
WshShell.SendKeys  "%"    '发送 ALT键
WshShell.SendKeys "{RIGHT}"    '发送向右箭头
WshShell.SendKeys "{RIGHT}"    '发送向右箭头
WshShell.SendKeys "{RIGHT}"    '发送向右箭头
WshShell.SendKeys "{RIGHT}"    '发送向右箭头
WshShell.SendKeys "{DOWN}"    '发送向下箭头
WshShell.SendKeys "{ENTER}"   '发送Enter键,确认选择帮助下拉列表中的帮助主题项
Window("记事本").Type micAltDwn +  micF4  + micAltUp  'ALT+F4关闭

抱歉!评论已关闭.