Jump to content

GUI checkboxes + hotkey


hmRaggy
 Share

Recommended Posts

Hello, I am working on a script and I am absolutley lost. I can make the GUI window and the checkbox. And I can make the hotkey with a script. I'm just lost as to what I need to do to insert a variable into my hotkeyed script to check for the checkbox, and if it is checked it will do something and if it is not checked then it will do nothing.

Crude example

When you press hotkey it will say;

"Test"

When you press hotkey with checkbox checked it will say;

"Working Test"

If someone can give me an example on how to do that, it would be much appreciated!

heres my messed up script, I just took stuff from some examples, but I have no idea how to get the checkboxes to interact with my hotkey script. I know I'm a total noob. But I've spent like 5 hrs trying to figure it out. If I can just get someone to show me how to make it work then I can make my full script for work. And work will get much easier!

#include <GUIConstants.au3>

;GUI WINDOW-------------------------

GUICreate("My GUI Checkbox" , 400 , 300 , 400 , 600 )

;CHECKBOXES-------------------------

GUICtrlCreateCheckbox ("test box", 10, 10, 120, 20)

;

;Where I need to add variables

;

;HOTKEY----------------------------------

AutoItSetOption ( "SendKeyDelay", 10 )

HotKeySet("{NUMPADDIV}", "one")

Func one();

;

;Where I need to add variables

;

Send("test{ENTER}", 0)

EndFunc

GuiSetState()

While GuiGetMsg() <> $GUI_EVENT_CLOSE

WEnd

Link to comment
Share on other sites

#include <GUIConstants.au3>
$GUI = GUICreate("My GUI Checkbox", 400, 300, 400, 600)
$CheckBox = GUICtrlCreateCheckbox("test box", 10, 10, 120, 20)
AutoItSetOption("SendKeyDelay", 10)
Dim $HotKey = "{F1}"
HotKeySet($HotKey, "One")
GUISetState()
While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd
Func One()
    Select
        Case GUICtrlRead($CheckBox) = $GUI_CHECKED
            Send("Working Test")
        Case Else
            Send("Test")
    EndSelect
EndFunc  ;==>One

There you go B)

Edited by AutoIt Smith
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...