scriptjunkie

Wait until done typing in input field

3 posts in this topic

I created a loop to check a field for information:
 

While 1
    _checker()
    sleep(25)
WEnd

Func _checker()

    ; read input box
    $data = GUICtrlRead($inp_box)
    
    if $data = "secretpass" then
        _allowin()
    else
        _invalid()
    endif

endfunc

I can't figure out how to wait until the user is done typing. The users will not be slow typers, so I just need like a 1-2 second wait between keypresses.

Anyone have an idea of how to do this?

Thanks for your input.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

add a button, when finished then press on button for check!

Edited by Trong

Regards,
 

Share this post


Link to post
Share on other sites
; Johnmcloud - 2016
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>

Global $iBegin, $fFlag = False

$hGUI = GUICreate("Test", 325, 100)
$cInput = GUICtrlCreateInput("", 10,  20, 300, 20)
GuiSetState()

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    If $fFlag And TimerDiff($iBegin) > 3000 Then
        $fFlag = False
        MsgBox(64, "Error", "Timed out")
    EndIf
WEnd

Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    Local $iIDFrom = BitAND($wParam, 0xFFFF)
    Local $iCode = BitShift($wParam, 16)
    If $iIDFrom = $cInput And $iCode = $EN_CHANGE Then
        $iBegin = TimerInit()
        $fFlag = True
        If GUICtrlRead($cInput) = "secretpass" Then
            Exit MsgBox(64, "Congrats", "Done")
        EndIf
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

 

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