Micro Focus QTP (UFT) Forums
holding a button down for a certain time - 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: holding a button down for a certain time (/Thread-holding-a-button-down-for-a-certain-time)



holding a button down for a certain time - tbakk53 - 07-24-2010

Hello,

Please help,

when using QTP, I was clicking on some buttons to simulate ceratin functions. If I want to do the same action but instead of clicking, I like to hold the button down for a duration like 30 seconds, do you know how to do that?

Thanks

tbakk


RE: holding a button down for a certain time - supputuri - 07-26-2010

Hi tbakk53,

You can use Type method and use the micshift or what ever button you want to press.

Code:
SwfWindow("Window").SwfTable("Table").Type micShiftDwn 'To press the shift key down
SwfWindow("Window").SwfTable("Table").Type micShiftUp  'To release the pressed key. Don't forget this LOC

Please let me know if you need any more info.


RE: holding a button down for a certain time - sasmitakumari - 07-26-2010

Hi SUpputuri,
I think you might have forgot to mention to provide wait time in between micShiftDwn and micShiftUp , whatever the duration tbakk53 wants to stay in between. so I have just corrected that in code.


RE: holding a button down for a certain time - supputuri - 07-26-2010

Hi sasmitakumari,

Thanks for the correction. But I think that is not required becuase he can release the key once he obtained the desired thing happened. He can use the validation check and then release the key.

Anyhow, thanks for the correction.