Pages

Wednesday, 19 October 2011

QTP Script: Examples of how to simulate key presses


Dim objShell

 

' Create the shell object

Set objShell = CreateObject ("WSCript.shell")

 

' Various key press examples

objShell.SendKeys "Hello" ' Hello
objShell.SendKeys "{F4}"  ' F4
objShell.SendKeys "^{F4}" ' CTRL-F4
objShell.SendKeys "+{F4}" ' SHIFT-F4
objShell.SendKeys "%{F4}" ' ALT-F4

 

' Destroy the object

Set objShell = Nothing

0 comments:

Post a Comment