Jump to content
Misomaniac

Hotkey-Settings

Recommended Posts

Misomaniac

Hey i am new in AutoIT. I am searching a Way to send a letter that is linked to a hotkey. Its possible? I made a little GUI but it doesnt work.

ESC=Exit

c=Show Message Box or if the Checkbox isnt active send "c"

 

Greetz

Test-c.au3

Share this post


Link to post
Share on other sites
Misomaniac

You dont need to download the Script. I will show it here:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 406, 308, 261, 200)
$testbox = GUICtrlCreateCheckbox("Testbox", 136, 104, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

HotKeySet("c", "_Config")
HotKeySet("{ESC}", "_Beenden")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func _Config()
    If GUICtrlRead($testbox) = 1 Then
        MsgBox($MB_SYSTEMMODAL, "Title", "The Checkbox is active.", 3)

    Else
        Send ("c")
        EndIf
EndFunc

Func _Beenden()
    Exit
EndFunc

 

Edited by Jos
added codebox

Share this post


Link to post
Share on other sites
Jos

what exactly is not working? 
I guess you do have to disable the hotkey before sending the actual character like:

Func _Config()
    If GUICtrlRead($testbox) = 1 Then
        MsgBox($MB_SYSTEMMODAL, "Title", "The Checkbox is active.", 3)

    Else
        HotKeySet("c")
        Send ("c")
        HotKeySet("c", "_Config")
    EndIf
EndFunc

Jos

Ps: Using codeboxes is a little easier to read. ;)  

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Misomaniac

Yes that was my mistake :) Thank you!

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

×