The following example shows the usage of PressKey method to send the keyboard input to an application using HP Quicktest Professional(QTP).

'A simple example that presses a key using Mercury DeviceReplay.

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 are listed below:
F1 - 59
F2 - 60
F3 - 61
F4 - 62
F5 - 63
F6 - 64
F7 - 65
F8 - 66
F9 - 67
F10 - 68
F11 - 87
F12 - 88

0 comments