Jump to content

Recommended Posts

Posted

I am creating a simple test program. I want to set a hotkey and when I press the hotkey the program will hold down a button for several seconds. The program isn't working so far. Here is the code.

HotKeySet( "q" , "key")
Func key()
Send( "{RIGHT DOWN}" )
Sleep(3000)
Send("{RIGHT UP}")
EndFunc
Posted (edited)

Welcome to the forum.

try:

HotKeySet("q", "key")

While 1
    Sleep(1000)
WEnd

Func key()
    Send("{RIGHT DOWN}")
    Sleep(3000)
    Send("{RIGHT UP}")
EndFunc   ;==>key

Edit: if this is for a game - read the help file under SendKeyDownDelay:

Alters the length of time a key is held down before being released during a keystroke. For applications that take a while to register keypresses (and many games) you may need to raise this value from the default. A value of 0 removes the delay completely.

Time in milliseconds to pause (default=5).

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

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
×
×
  • Create New...