Jump to content

UDF _release_wait


Sven
 Share

Recommended Posts

Out of the necessity to wait for the hotkey to be released in order for the script to proceed, I've written this _release_wait UDF. Feel free to improve, adapt and optimize it for your own needs.

_release_wait function

#include <misc.au3>

Func _release_wait()
    $hex = Hex(Asc(StringUpper(@HotKeyPressed))); this converts our hotkey into a format that _ispressed can work with
    HotKeySet(@HotKeyPressed, '_release_wait_dummy'); can't disable hotkey, because if we did we'd be spammed with the letter / number / whatever we're holding down
                                                    ; can't disable input because then the up event of our hotkey wouldn't be registered
    Do
        Sleep(10)
    Until Not _IsPressed($hex) ; $hex is the hotkey used; non number & letter buttons need special treatment, like > and not _ispressed('0d') < (enter key)
    HotKeySet(@HotKeyPressed, '_' & @HotKeyPressed)
EndFunc   ;==>_release_wait

Func _release_wait_dummy()
    ; does nothing but is still needed
EndFunc   ;==>_release_wait_dummy
Link to comment
Share on other sites

muttley

cool new avatar!

Way to change the subject instantly.

[quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote]

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