Sign in to follow this  
Followers 0
Indrion

How do I get a key to imput longer?

7 posts in this topic

I'm trying to make a script that will make me move forward and back in a game, I have this so far:

HotKeySet( "{ESC}", "Close" )

$Key1 = InputBox( "Input key", "Enter a key that will be repeated." )
$Key2 = InputBox( "Input key", "Enter a key that will be repeated." )


while 1
    Sleep( 1000 )
    Send( $Key1 )
    Send( $Key2 )
WEnd


Func Close()
    Exit()
EndFunc

But when I run it, it sends the imputs too fast for the game to register. How would I fix that?

Share this post


Link to post
Share on other sites



Opt('SendKeyDownDelay', 250) ?

Share this post


Link to post
Share on other sites

Where would that go?

I have almost no experience writing code.

Share this post


Link to post
Share on other sites

So like this?

HotKeySet( "{ESC}", "Close" )

$Key1 = InputBox( "Input key", "Enter a key that will be repeated." )
$Key2 = InputBox( "Input key", "Enter a key that will be repeated." )


while 1
    Sleep( 1000 )
    Send( $Key1 )
    Send( $Key2 )
    Opt('SendKeyDownDelay', 250)
WEnd


Func Close()
    Exit()
EndFunc

Share this post


Link to post
Share on other sites

Almost, like this:

Opt('SendKeyDownDelay', 250)
HotKeySet( "{ESC}", "Close" )

$Key1 = InputBox( "Input key", "Enter a key that will be repeated." )
$Key2 = InputBox( "Input key", "Enter a key that will be repeated." )


while 1
    Sleep( 1000 )
    Send( $Key1 )
    Send( $Key2 )
WEnd


Func Close()
    Exit()
EndFunc

Share this post


Link to post
Share on other sites

Ah, thanks. I'll catch on eventually.

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