Sign in to follow this  
Followers 0
ProGrammar

HotKey function problem

4 posts in this topic

Hi there! I would want help with the HotKey function, i've read the commands for HotKey in the help file but im not see any code that might be possible to disable the hotkey for a minute?

I would also want nearly all hotkeys (ALL EXCEPT pause and quit) i have to disable when im using the pause function!

Because if i have a hotkey on button "K" and im typing to a friend then the "K" button wont work.

So can someone please tell me if its possible to disable the hotkey in some way? Without close the program

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

'function [optional] The name of the function to call when the key is pressed. Not specifying this parameter will unset a previous hotkey. '

Edited by KaFu

Share this post


Link to post
Share on other sites

Global $hotkeysset = True

HotKeySet("{PAUSE}", "TogglePause")

_enablehotkeys()

while 1
    sleep(20)
WEnd

Func TogglePause()
    $hotkeysset = Not $hotkeysset
    If $hotkeysset = True Then
        _enablehotkeys()
    Else
        _disablehotkeys()
    EndIf
    MsgBox(0,'','Hotkeys set? ' & $hotkeysset)
    
EndFunc  ;==>TogglePause


func _enablehotkeys()
    HotKeySet('a','_func_hotkey_a')
    HotKeySet('b','_func_hotkey_b')
    HotKeySet('c','_func_hotkey_c')
EndFunc


func _disablehotkeys()
    HotKeySet('a')
    HotKeySet('b')
    HotKeySet('c')
EndFunc


func _func_hotkey_a()
    MsgBox(0,'','a pressed')
EndFunc

func _func_hotkey_b()
    MsgBox(0,'','b pressed')
EndFunc

func _func_hotkey_c()
    MsgBox(0,'','c pressed')
EndFunc

Share this post


Link to post
Share on other sites

Global $hotkeysset = True

HotKeySet("{PAUSE}", "TogglePause")

_enablehotkeys()

while 1
    sleep(20)
WEnd

Func TogglePause()
    $hotkeysset = Not $hotkeysset
    If $hotkeysset = True Then
        _enablehotkeys()
    Else
        _disablehotkeys()
    EndIf
    MsgBox(0,'','Hotkeys set? ' & $hotkeysset)
    
EndFunc ;==>TogglePause


func _enablehotkeys()
    HotKeySet('a','_func_hotkey_a')
    HotKeySet('b','_func_hotkey_b')
    HotKeySet('c','_func_hotkey_c')
EndFunc


func _disablehotkeys()
    HotKeySet('a')
    HotKeySet('b')
    HotKeySet('c')
EndFunc


func _func_hotkey_a()
    MsgBox(0,'','a pressed')
EndFunc

func _func_hotkey_b()
    MsgBox(0,'','b pressed')
EndFunc

func _func_hotkey_c()
    MsgBox(0,'','c pressed')
EndFunc

Aaah, okey! Thanks :)

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  
Followers 0