Ask a Question

Press and hold 2 keys

neens
New Contributor

Press and hold 2 keys

In my desktop application I need to similate Alt and 1 keys pressed together and held for 3 seconds. Tried Key down and Key up, nothing worked. 

LLPlayer.KeyDown([VK_MENU][0x31], delay);

Delay(3000);

LLPlayer.KeyUp([VK_MENU][0x31], delay);

 

4 REPLIES 4
tristaanogre
Esteemed Contributor

Not sure why you have the additional numbers in place.  You should be able to just do

 

LLPlayer.KeyDown(VK_MENU, 500)

aqUtils.Delay(3000);

LLPlayer.KeyUp(VK_MENU, 500)


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

LLPlayer.KeyDown(VK_MENU, 500) is only for to press Alt key.

I want to press and hold Alt and 1 key together for 3 seconds.

Alt+1 press and hold I mean.

tristaanogre
Esteemed Contributor

You'll need to then make sure you include a KeyDown for the 1 key as well... you can't put two keys in the same KeyDown method.

 

So

 

LLPlayer.KeyDown(VK_MENU, 500)

LLPlayer.KeyDown(31, 500)

aqUtils.Delay(3000)

LLPlayer.KeyUp(VK_MENU, 500)

LLPlayer.KeyUp(31, 500)


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
TanyaYatskovska
SmartBear Alumni (Retired)

Thanks for your help, @tristaanogre!

 

@neens, if the suggestions given here help you resolve the question, select the best answer as a solution.

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: