Sign in to follow this  
Followers 0
astrax

on/off toggle with checkbox to disable/enable hotkeyset help

2 posts in this topic

Hi

I need help writing a script to enable/disable hotkeys in a function. I got the first part correct where the checkbox needs to be checked before any hotkeys can activate. But the disabled part i need help with. Here's my example

Case $Checkbox
        If GUICtrlRead($Checkbox) = $GUI_UNCHECKED Then
    Off()
    Else
    On()
    EndIf

Func On()

HotKeySet("F1", "Start")

EndFunc

Func Off()

;disable all hotkeys. 

EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You should try the helpfile, it won't bite! :D

First you are checking the checkbox the wrong way. As the page for GUICtrlRead() says:

For Checkbox, Radio control several states can be returned as $GUI_FOCUS and $GUI_CHECKED,. So use i.e. BitAnd(GUICtrlRead($Item),$GUI_CHECKED) to test if the control is checked.

And in the page for HotKeySet().

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

Edited by AdmiralAlkex

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