Jump to content

HotkeySet Push key?

Recommended Posts


Anyone knows how i can make a push key?

Like if u hold down it it works and when you realese the key, it stops

Share this post

Link to post
Share on other sites

Run script and immediately press and hold F2.

#include <misc.au3>

$key_code = "71"
$key_name = "F2"

ConsoleWrite(@CRLF & "Press and hold: " & $key_name)

; This Sleep() gives the User time to press key

$sec = -1
While _IsPressed($key_code)
    Sleep(10); Don't burn processor: NOTE this Sleep would not be required if GUIGetMsg() was in loop
    ; This If condition prevents console spam that could collect beyond the press of the key
    If $sec <> @SEC Then
        $sec = @SEC
        ConsoleWrite(@CRLF & $key_name & " is pressed " & @MIN & ": " & $sec)
WEnd; _IsPressed($key_code)



Edited by Xandy

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


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.