Jump to content

Input


strate
 Share

Recommended Posts

I have a simple gui, just a window and a input box. I have a loop that reads the input for a special character "*". When it receives the character it exits the loop.

Func _ScanGUI()
    GUICreate ("Scan Bar-code from Audit Tag:", 320, 30, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 100, -1, 0x0)
    $2D_SCAN_INPUT = GUICtrlCreateInput ("", 10, 5, 300, 20)
;~  GUICtrlSetState (-1, $GUI_HIDE)
    GUISetState()
    BlockInput(0)
    _Log('Scan GUI created waiting for user input.')
    While 1 ; Wait for user action
        Sleep(2)
        $msg = GUIGetMsg ()
        $s_ScannerRead = GUICtrlRead($2D_SCAN_INPUT)
        Select
            Case StringRight($s_ScannerRead, 1) = "*"
                GUIDelete ()
                _Log('Proper barcode suffix received.')
                ExitLoop
            Case $msg = $GUI_EVENT_CLOSE
                _Log('User exited the program, clicked "X".')
                MsgBox(48, "Notice", "You have choose to exit.")
                WinSetState("18.14", "", @SW_SHOW)
                IniDelete($ini_File,'Time Stamp')
                Exit
            Case StringInStr($s_ScannerRead, "'") ; Scanned Wrong Bar-code
                MsgBox(48, "Notice", "You must scan the proper bar-code to continue.")
                _Log('User scanned wrong barcode: ' & $s_ScannerRead & '.')
                ControlSetText("Scan Bar-code from Audit Tag:",'',$2D_SCAN_INPUT,'')
                ContinueLoop
        EndSelect
    Wend
    BlockInput(1)
    Return $s_ScannerRead
EndFunc

The problem is it runs kinda slow, and i don't want the user to be able to remove focus from the input with accidental clicks else where. Are there any other ways to achieve what I'm trying to do?

A scan gun is used in the process. A barcode that could be read resembles 123456?6545?5000*

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to comment
Share on other sites

I have no idea how to incorporate that into this after lookin' at the help file.

You won't find it in the help, this should point you in the right direction http://www.autoitscript.com/forum/index.ph...st&p=291590

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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