StudioMaker

HotkeySet Push key?

3 posts in this topic

#1 ·  Posted

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



#2 ·  Posted (edited)

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
Sleep(1200)

$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)
    EndIf
WEnd; _IsPressed($key_code)

 

 

Edited by Xandy

Share this post


Link to post
Share on other sites

#3 ·  Posted

Ty ;)

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