VBScript 根据IE窗口的标题输出ESC(vbs弹出对话框代码)难以置信

随心笔谈12个月前发布 admin
99 0


‘测试函数
PressESC “Windows Internet Explorer”, “{ESCAPE}”

‘我们要处理的函数
Function PressESC(WindowTitle, KeyCommand)
Set objShell=CreateObject(“WScript.Shell”) ‘定义一个WHS对象
If objShell.AppActivate(WindowTitle) Then ‘检测是否有我们要检测的Windows
objShell.AppActivate WindowTitle ‘把窗口对焦
objShell.SendKeys KeyCommand ‘发送一个ESC键
End If
End Function

© 版权声明

相关文章