Micro Focus QTP (UFT) Forums
Can hold a key press for 10 seconds ? - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Can hold a key press for 10 seconds ? (/Thread-Can-hold-a-key-press-for-10-seconds)



Can hold a key press for 10 seconds ? - subiya - 06-23-2010

Hi
I have to hold a key press for 10 second in my test. Is there any option in QTP\VBscript to do this ?

Please give me an answer...


RE: Can hold a key press for 10 seconds ? - guin.anirban - 06-23-2010

Can you check the following and let me know whether it's working or not?

Code:
Print Time

b = DateAdd("s", 10, Time)

Set WshShell = CreateObject("WScript.Shell")

Do While (Time < b)        
        
        WshShell.SendKeys "{ENTER}"

Loop

Print Time

Set WshShell = Nothing