Sign in to follow this  
Followers 0
Orange9

Holding down keyboard keys

7 posts in this topic

Er...i dont know how to hold down a certain key on the keyboard. I've read the help function n it gave me various commands for it, but the parameters dont make sense. For example the Opt("SendKeyDownDelay", x) where x is the number of milliseconds. Well, it requires me to input the amount of time to hold the key for, which is great, but where do i input the actual key that it presses? For example if i wanted to hold down the key "a", where do i put that?

Share this post


Link to post
Share on other sites



You know, the help file is a lot more helpful than you may think.

To hold a key down (generally only useful for games)

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

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


Who else would I be?

Share this post


Link to post
Share on other sites

Yes, i know, i've read that too. But the problem with THIS command is that it doesnt ask u how long to hold that particular key for.

Share this post


Link to post
Share on other sites

Opt("SendKeyDownDelay", 1000);set subesquent keys to be held down for 1000ms

send("a");key a is held down for 1000ms then released

.

.

.

Opt("SendKeyDownDelay", 10);keys will be held down for 10 ms from now on


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Opt is an alias for AutoItSetOption, which is function that is used to configure how some

parts of AutoIt works. It doesn't do any action in itself.

When using Opt with "SendKeyDownDelay" you set how long the release-delay for Send

should be, for example when you send "a". However when you use Send like this-is-me

showed, sending "{a down}", I believe it's up to the scripter to manually release it, by

sending "{a up}".

So, what do you want ? Do you want the script to just send "a" and then continue, or do

you want the script to hold down "a", do some stuff and then release "a" again ?

Share this post


Link to post
Share on other sites

Cool. But it doesnt seem to work for me. When i open notepad, if i hold down the button, lets say "a", it supposed to keep repeating "a"s on the notepad until i release the "a" button right? but it doesnt ><

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

You really need to be more specific of what you want. If you just need to hold down a key then

Send("{a down}")
Sleep("INPUT TIME")
Send("{a up}")

Please explain exactly what you expect the "a" key to do.

Edited by dandymcgee

- Dan [Website]

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