Jump to content

Holding down a key on the keyboard


Recommended Posts

Yeah, i've read the help function and and it tells me how to hold a key on the keyboard. Something like this: Opt("SendKeyDownDelay", x) where x is the number of milliseconds to hold the button for. Sure, thats great, but there is no parameter for me to input the key i want to press.

The other method, where it says something like this:

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

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

Yeah, i can input the key i want, but theres no parameter for me to input the time i want it to hold the button. So...im kinda lost lol. It'd be great if someone can help me on this ^^

Link to comment
Share on other sites

Yeah, i've read the help function and and it tells me how to hold a key on the keyboard. Something like this: Opt("SendKeyDownDelay", x) where x is the number of milliseconds to hold the button for. Sure, thats great, but there is no parameter for me to input the key i want to press.

The other method, where it says something like this:

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

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

Yeah, i can input the key i want, but theres no parameter for me to input the time i want it to hold the button. So...im kinda lost lol. It'd be great if someone can help me on this ^^

Hi,

First this Opt("SendKeyDownDelay", x)

Second this Send("your key")

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

What about

Send ( "{a down}" )

Sleep ( 1000 )

Send ( "{a up}" )

to hold it for 1 second ?

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

HI,

or try this:

Run("notepad.exe")

Dim $time = 1000.00
Sleep(1000)
$begin = TimerInit()
While Round(TimerDiff($begin),2) <= $time
    Send("a")
    ToolTip(Round(TimerDiff($begin),2))
WEnd
Exit

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Alright, thx a lot! btw, is it possible to hold 2 keyboard buttons simultaneously? if so, how?

uhh

Send ("{a down}")
Send ("{b down}")
Sleep(1000)
Send ("{a up}")
Send ("{b up}")

i think that would work, hold them both down for 1 second.

edit: lol, manadar posted the exact same code as me...

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

oic....well what if i want to press the up and left arrow at the same time for 1 second? I tried:

Send ("{{up} down}")

Send ("{{left} down}")

Sleep (1000)

Send ("{{up} up}")

Send ("{{left} up}")

But i dont think it worked. AutoIt actually press those letters instead =/

Link to comment
Share on other sites

oic....well what if i want to press the up and left arrow at the same time for 1 second? I tried:

Send ("{{up} down}")

Send ("{{left} down}")

Sleep (1000)

Send ("{{up} up}")

Send ("{{left} up}")

But i dont think it worked. AutoIt actually press those letters instead =/

Send ("{up down}")
Send ("{left down}")
Sleep (1000)
Send ("{up up}")
Send ("{left up}")

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

  • Moderators

Or maybe it's the combination of the three of us, causing telepathy. The US Army would pay millions for such a thing. *dollar signs in eyes*

No, they'd request your assistance for free, and if you declined, kill you so no one else could have you at a cost.... You didn't see that comming?

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...