Jump to content

Key down


 Share

Recommended Posts

What is the code for holding a key down ?

Like in games if you walk you hold key down w (or z) for 10 seconds.

I already tried with sending always again a new w (or z) in the game but the games freaks and crash. So i need to now how i can keep the key down for X seconds

Exemple :

You are walking 100 yards. So the key must be like 10 seconds down before you reach the finish or so.

Hope you guys can help me.

Link to comment
Share on other sites

$secondsToHoldKey = 10 ;change this if you want
$KeyToPress = "w" ;also change this if you want

Send ("{"&$KeyToPress&" DOWN}")
Sleep ($secondsToHoldKey*1000)
Send ("{"&$KeyToPress&" 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

$secondsToHoldKey = 10 ;change this if you want

$KeyToPress = "w" ;also change this if you want

Send ("{w DOWN}")

Sleep ($secondsToHoldKey*1000)

Send ("{w UP}")

But i run it, i've got a character w

hold key "w" for 10 seconds, i must got "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww" ?

Link to comment
Share on other sites

You just want to push 'w' over and over? Stick the above in a loop. Or, you can just do it like this:

HotKeySet('{esc}', 'quit')

$millisecondsToDelayKey = 50 ;change this if you want
$KeyToPress = "w" ;also change this if you want

While 1
    Send ("{"&$KeyToPress&"}")
    Sleep ($millisecondsToDelayKey)
WEnd

Func quit()
    Exit
EndFunc
Edited by xcal
Link to comment
Share on other sites

  • 8 years later...

Don't work!

i can't do this!!!

if I exec this:

$secondsToHoldKey = 10 ;change this if you want
$KeyToPress = "w" ;also change this if you want

Send ("{"&$KeyToPress&" DOWN}")
Sleep ($secondsToHoldKey*1000)
Send ("{"&$KeyToPress&" UP}")

the result is:

w

and stop.....

whyyyyyy?!?! :'(

Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key
Link to comment
Share on other sites

This thread is nearly 9 years old and all participants have been offline for years.
A lot has changed in the meantime: Did you notice that discussing game automation is no longer permitted on this forum?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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