Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

how to make a script holding a key?


  • Please log in to reply
1 reply to this topic
kinghelp
  • Members
  • 1 posts
  • Last active: Oct 29 2015 03:41 AM
  • Joined: 29 Oct 2015

i want a script that a key is pressed, keep it holding for 3sec and release it.

 

i already know there is a funtion that 'send {key down}'

 

so i made it like a following, but it doesn't work.

 

 

Numpad0::

{

send {Numpad5 down}

sleep 3000

send {Numpad5 up}

}

return

 

 

i think if it work on notepad, show like this

 

55555555555555555555555555555555555555555555555555555555555555555555

 

but it work like this

 

5

 

 

how do i make it?

 

 

additionally, i don't want an answer using 'loop' fuction.

 

i'll use ti to games.

 

loop is not worty to them and they even doen't recongnize 'send' function.



Jackie Sztuk _Blackholyman
  • Spam Officer
  • 3757 posts
  • Last active: Apr 03 2016 08:47 PM
  • Joined: 28 Feb 2012
Send is what you
have to work with

And the repeating
of the held key
comes from the
keyboard driver
not from the OS

So even if the key
state is down the
key will not
automatically repeat.

To make it repeat if
that's what you want
then loop or settimer
is the way to go

Games has there own issues
when trying to send
key events as some of
them uses their own method
to detect keystrokes

So first find a way that
you game will allow you
to send keys then figure
out how to modify that for
whatever your trying to do
Helping%20you%20learn%20autohotkey.jpg?d

[AHK] Version. 1.1+ [CLOUD] DropBox ; Copy [WEBSITE] Blog ; About