Jump to content

Bar Code Scanner Project


greyhound125
 Share

Recommended Posts

Hi, Hopefully someone can help me with a problem. I am trying to create a form to scan bar codes. I created the form and input boxes without trouble, but when I scan the bar code, it scans properly, but simply highlights what I just scanned. I need the cursor to move to the next input box. I have reviewed the forums and cannot quite seem to find what I need. Any assistance would be greatly appreciated. I have included the basic gui with 2 input boxes.

CODE
#include <GUIConstants.au3>

GUICreate("Scanner GUI")

GUISetState (@SW_SHOW)

GuiCtrlCreateLabel("Bar Code", 10, 15, 150, 20)

GUICtrlCreateInput ("", 10, 35, 300, 20)

GuiCtrlCreateLabel("S/N", 10, 55, 150, 20)

GUICtrlCreateEdit ("", 10, 75, 300, 20)

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

Link to comment
Share on other sites

My Barcode USB Scanner treats end of lines as enters. Using a Hotkeyset listed in the code, it detects for enter and sends tab.

Used your code to test. Scanning into the first field, it'll send tab right after that. Appears to function. Test on yours.

CODE

#include <GUIConstants.au3>

HotKeySet("{ENTER}", "enterfunc")

GUICreate("Scanner GUI")

GUISetState (@SW_SHOW)

GuiCtrlCreateLabel("Bar Code", 10, 15, 150, 20)

GUICtrlCreateInput ("", 10, 35, 300, 20)

GuiCtrlCreateLabel("S/N", 10, 55, 150, 20)

GUICtrlCreateEdit ("", 10, 75, 300, 20)

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

Func enterfunc()

Send("{TAB}")

EndFunc

Link to comment
Share on other sites

My Barcode USB Scanner treats end of lines as enters. Using a Hotkeyset listed in the code, it detects for enter and sends tab.

Used your code to test. Scanning into the first field, it'll send tab right after that. Appears to function. Test on yours.

CODE

#include <GUIConstants.au3>

HotKeySet("{ENTER}", "enterfunc")

GUICreate("Scanner GUI")

GUISetState (@SW_SHOW)

GuiCtrlCreateLabel("Bar Code", 10, 15, 150, 20)

GUICtrlCreateInput ("", 10, 35, 300, 20)

GuiCtrlCreateLabel("S/N", 10, 55, 150, 20)

GUICtrlCreateEdit ("", 10, 75, 300, 20)

; Run the GUI until the dialog is closed

While 1

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

Func enterfunc()

Send("{TAB}")

EndFunc

Thanks I will also try this method. I actually read through my manual and found how to re-program the terminator to tab. Thanks for the help.
Link to comment
Share on other sites

Hi, Hopefully someone can help me with a problem. I am trying to create a form to scan bar codes. I created the form and input boxes without trouble, but when I scan the bar code, it scans properly, but simply highlights what I just scanned. I need the cursor to move to the next input box. I have reviewed the forums and cannot quite seem to find what I need. Any assistance would be greatly appreciated. I have included the basic gui with 2 input boxes.

No need to reprogram your scanner, simply switch to using OnEvent mode for your Gui and it's simple:

Opt("GUIOnEventMode", 1)
#include <GUIConstants.au3>

$guiScanner = GUICreate("Scanner GUI")
GUISetOnEvent($GUI_EVENT_CLOSE, "_ExitScript")

GUICtrlCreateLabel("Bar Code", 10, 15, 150, 20)
$inpBarCode = GUICtrlCreateInput("", 10, 35, 300, 20)
GUICtrlSetOnEvent(-1, "_OnScan")

GUICtrlCreateLabel("S/N", 10, 55, 150, 20)
$edtSerialNum = GUICtrlCreateEdit("", 10, 75, 300, 20)

GUICtrlSetState($inpBarCode, $GUI_FOCUS)
GUISetState(@SW_SHOW)

; Run the GUI until the dialog is closed
While 1
    Sleep(100) ;since we're using OnEventMode, just idle here, no checking for GuiMsg
WEnd

Func _OnScan()
    ControlSend($guiScanner, "", $inpBarCode, "{TAB}")
EndFunc   ;==>_OnScan

Func _ExitScript()
    Exit
EndFunc   ;==>_ExitScriptoÝ÷ ØßiËHÂ¥uëÞË ë-©"ayÊyú+:tj{(ëax&¢·¥GºÚ"µÍ[ÈÓÛØØ[
BÕRPÝÙ]Ý]J  ÌÍÙYÙX[[K   ÌÍÑÕRWÑÐÕTÊB[[ÈÏOIÝ×ÓÛØØ[oÝ÷ Ùú+·µêÚqË«iÌ2ýµ¡jÜ°ay"
÷bjw²)r²Ö²Â+aèzÓ,)ìµæ¡ó§÷§´Êx¬¶jü²¢ê+§jW(uëh²¶§X¤zØb±«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì()U%
ÉÑ ÅÕ½ÐíM¹¹ÈU$ÅÕ½Ðì¤()U%
Ñɱ
ÉÑ1° ÅÕ½Ðí  È
½ÅÕ½Ðì°ÄÀ°ÄÔ°ÄÔÀ°ÈÀ¤(ÀÌØí¥¹Á É
½ôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÅÕ½Ðì°ÄÀ°ÌÔ°ÌÀÀ°ÈÀ¤()U%
Ñɱ
ÉÑ1° ÅÕ½ÐíL½8ÅÕ½Ðì°ÄÀ°ÔÔ°ÄÔÀ°ÈÀ¤(ÀÌØíÑMÉ¥±9Õ´ôU%
Ñɱ
ÉѥРÅÕ½ÐìÅÕ½Ðì°ÄÀ°ÜÔ°ÌÀÀ°ÈÀ¤()U%
ÑɱMÑMÑÑ ÀÌØí¥¹Á   É
½°ÀÌØíU%}=
UL¤)U%MÑMÑÑ¡M]}M!=¤((ìIոѡU$չѥ°Ñ¡¥±½¥Ì±½Í)]¡¥±Ä($ÀÌØíµÍôU%Ñ5Í ¤(%MÝ¥Ñ ÀÌØíµÍ($%
ÍÀÌØíU%}Y9Q}
1=M($$%á¥Ð($%
ÍÀÌØí¥¹Á    É
½($$%U%
ÑɱMÑMÑÑ ÀÌØíÑMÉ¥±9Õ´°ÀÌØíU%}=
UL¤(%¹MÝ¥Ñ )]¹
Edited by ResNullius
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...