Sending Keyboard Input to an Application

While using the QTP I came across the scenario where i need to press my keyboard keys and for that i found Device replay more suitable.

The Code lines that can be used to press keyboard keys are :

Set obj = CreateObject("Mercury.DeviceReplay")

Window("Notepad").Activate

obj.PressKey 63 


The PressKey method uses the ASCII value for the key.
63 is the ASCII value for F5.
ASCII values for other keys:
F1 - 59
F2 - 60
F3 - 61
F4 - 62
F5 - 63
F6 - 64
F7 - 65
F8 - 66
F9 - 67
F10 - 68
F11 - 87
F12 - 88

Comments