Jump to content

HotkeySet Push key?

Recommended Posts

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

  • Create New...