switching edit box based on #of characters

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Mkonopko
Posts: 21
Joined: 25 Jan 2015, 07:30

switching edit box based on #of characters

03 Jun 2016, 11:31

I need to able to scan 2 barcodes and compare them without ever having to touch a keyboard. Here is part of my code. It works until I try to add anything even a msgbox that would display the contents of the variable.

Any ideas?

Code: Select all

#SingleInstance
Edit1=
Edit2=
Gui, Add, Edit, vEdit1 gLabel
Gui, Add, Edit, vEdit2 glabel

Gui, Show
return
GuiClose:
 ExitApp

Label:
 Gui, Submit, NoHide
 If StrLen(Edit1) > 11
  GuiControl, Focus, Edit2
  Gui, Submit, NoHide
 If StrLen(Edit2) > 11
	Gui, submit, hide2
		
MsgBox, %Edit1%
return
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: switching edit box based on #of characters

04 Jun 2016, 00:47

What are you expecting? The barcode scanner sends a bunch of keystrokes all at once. If you pop up a MsgBox after the first keystroke, of course the rest of the barcode scanner's keystrokes are going to be sent to the MsgBox, not your GUI.

Maybe you're just missing braces to show the program (and us) which lines are supposed to belong to your IF statements. (For example, to show the MsgBox only when StrLen(Edit2) > 11.)

When you post code, use code tags around your code, either by typing them or by pressing the

Code: Select all

 button in the full post editor.  I have added them to your post so you can see how it looks.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Google Adsense [Bot] and 304 guests