Jump to content

I Cant Believe I'm Asking This But...


Recommended Posts

I can't get autoit tohold down a button *:)

heres my code

Send( "{a down}" )
Sleep( 5000 )
Send( "{a up}" )

Now shouldn't this hold down "a" for two seconds?

[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Link to comment
Share on other sites

  • Moderators

look at SendKeyDownDelay() in the help... and use Send('a')

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I'm going to predict his next question since I've seen it before:

he's going to want to know why it doesn't type repeatedly in any edit field if it's really holding the "a" down. The reason is because of the way AutoIt is set up, and because of the way different computers have different times set for repeat. In the helpfile it says you can do the {a down} and {a up} but also that it is generally useful only for games, and the reason is because AutoIt is built to not let it repeat.

Link to comment
Share on other sites

  • Moderators

I'm going to predict his next question since I've seen it before:

he's going to want to know why it doesn't type repeatedly in any edit field if it's really holding the "a" down. The reason is because of the way AutoIt is set up, and because of the way different computers have different times set for repeat. In the helpfile it says you can do the {a down} and {a up} but also that it is generally useful only for games, and the reason is because AutoIt is built to not let it repeat.

Yeah... For repeating, I guess you could make your own UDF:
_SendMulti('a', 5)


Func _SendMulti($v_Send, $i_Time, $i_Delay = 0)
    Local $Timer = TimerInit()
    If $i_Delay = 0 Then
        Do
            Send($v_Send)
        Until TimerDiff($Timer) / 1000 >= $i_Time
    Else
        Do
            Send($v_Send)
            Sleep($i_Delay)
        Until TimerDiff($Timer) / 1000 >= $i_Time
    EndIf
EndFunc
Edit: Forgot a Variable.... Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...