cancel
Showing results for 
Search instead for 
Did you mean: 

Press and hold 2 keys

Highlighted
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
Highlighted
Community Hero

Re: Press and hold 2 keys

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
Highlighted
New Contributor

Re: Press and hold 2 keys

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.

Highlighted
Community Hero

Re: Press and hold 2 keys

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
Highlighted
Community Manager

Re: Press and hold 2 keys

Thanks for your help, @tristaanogre!

 

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

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
Let's start July with new challenges!

Create a script to pass custom command-line arguments as a test parameter for the TechCorner tag!

Will you dare to take the challenge?


Top Kudoed Authors