Jump to content

Recommended Posts

Posted

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

Posted (edited)

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
  • Developers
Posted (edited)

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 etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Moderators
Posted

Moved to the appropriate forum, as the Dev forum very clearly states:

Quote

Do not create AutoIt-related topics here, use AutoIt General Help and Support

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
×
×
  • Create New...