Jump to content
Sign in to follow this  
Sven

UDF _release_wait

Recommended Posts

Sven

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

Share this post


Link to post
Share on other sites
ludocus

dude.. this is soooo simple..

Share this post


Link to post
Share on other sites
Sven

Sure it's simple... or not, depending on who you ask.

Share this post


Link to post
Share on other sites
MerkurAlex

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]

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
Sign in to follow this  

×

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.