Micro Focus QTP (UFT) Forums
Using SendKey for a key-combination - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Using SendKey for a key-combination (/Thread-Using-SendKey-for-a-key-combination)



Using SendKey for a key-combination - paulv - 09-09-2008

Who knows how to use the SendKey (or another) function to send a key-combination to a Terminal Emulator ?
I would like to send the combination [Alt]+[F1] to retrieve extra info on user-messages in our application.


RE: Using SendKey for a key-combination - anemuday - 09-09-2008

Hi,

You can use the below statements:

Code:
Dim WshellObj
Set WshellObj=WScript.CreateObject("WScript.Shell")
WshellObj.SendKeys "%+{F1}"

But make sure, whether QTP set context to the application before the these statements.

Regards,
Uday.


RE: Using SendKey for a key-combination - paulv - 09-09-2008

Thanks, works great !

Was already experimenting with the Sendkeys-function but it didn't work ... because I didn't know about the "+" in the middle Smile

Rgds,
Paul

-------------------------------------------------------------------
Hi,

You can use the below statements:

Code:
Dim WshellObj
Set WshellObj=WScript.CreateObject("WScript.Shell")
WshellObj.SendKeys "%+{F1}"

But make sure, whether QTP set context to the application before the these statements.

Regards,
Uday.


RE: Using SendKey for a key-combination - paulv - 10-24-2008

Hi Uday,

I've tried this code again (after leaving QTP aside for a while), and for some reason I get following error-message now on the line with the Set-command : " Object required: 'WScript' ".
Any idea ?


Rgds,
Paul