Jump to content

Recommended Posts

Posted (edited)

#include <GUIConstants.au3>

$GUI = GUICreate("", 162, 96, -1, -1)
$Input = GUICtrlCreateInput("Type hello then hit enter!", 8, 8, 145, 21)
$Send = GUICtrlCreateButton("&Send", 32, 40, 89, 41, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Input
            If GuiCtrlRead($Input) = "Hello" Then
                MsgBox(4096, "Hello!", "You pressed the enter key!")
            EndIf
        Case $Send
            If GuiCtrlRead($Input) = "Hello" Then
                MsgBox(4096, "Hello!", "You pressed the send key!")
            EndIf
    EndSwitch
WEnd

That's a better example.

-James

Edited by NeoTroniX
Posted

#include <GUIConstants.au3>

$GUI = GUICreate("", 161, 37, -1, -1)
$Input = GUICtrlCreateInput("Type hello then hit enter!", 8, 8, 145, 21)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Input
            If GuiCtrlRead($Input) = "Hello" Then
                MsgBox(4096, "Hello!", "You pressed the enter key!")
            EndIf
    EndSwitch
WEnd

Modified NeoTroniX's example. Is this more like what you want?

Posted

This is more what I needed:

DUH!! to me, I found this in the FAQ sticky

HotKeySet("{ENTER}", "catchguikey")
;
;REST OF CODE HERE
;
;
Func catchguikey()
    Local $opt = Opt("WinTitleMatchMode", 4)
    If WinGetHandle("active") = $DB Then
        If @HotKeyPressed = "{ENTER}" Then
            ;Do something here
           _IENavigate($oIE, GUICtrlRead( $manualaddy ), 0)
        EndIf
    Else
        HotKeySet(@HotKeyPressed)
        Send(@HotKeyPressed)
        HotKeySet(@HotKeyPressed, "catchguikey")
    EndIf
    Opt("WinTitleMatchMode", $opt)
EndFunc
Posted

sort of, your way will be triggered on a mouse click to the edit box as well as pressing enter, where as the one I used is ONLY for pressing enter

Also I changed the code a bit so that the proper window and the proper control must be selected.

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...