Sign in to follow this  
Followers 0
Ritzky

Hold Key Down

6 posts in this topic

I've seen lots of threads where I can hold a key down for a certain period of time, but all of them involve "sleep". What if I want to do other things while the key is being held down? Does AutoIt support this?

Something like: Send("{Up 1000}")

That will press the up arrow 1000 times, is there anyway to hold the key down for 1000ms? (Without using sleep)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

From the help file:

"To hold a key down

Send("{a down}") ;Holds the A key down

Send("{a up}") ;Releases the A key"

Edited by megablox
1 person likes this

"The story of a blade is linked in Blood." 

―Yasuo

 

Share this post


Link to post
Share on other sites

What the problem with using sleep(1000)?


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

What the problem with using sleep(1000)?

He wants to execute code when the key is held down, he did not know how to do it instead of setting a Sleep which prevents from executing something else.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

That doesn't hold a key down for a set amount of time, it holds it down forever until I call the KeyUp function.

Share this post


Link to post
Share on other sites

That doesn't hold a key down for a set amount of time, it holds it down forever until I call the KeyUp function.

Then you call KeyUp after a set amount of time. Look up for example AdlibRegister().

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0