greyhound125 Posted February 18, 2008 Share Posted February 18, 2008 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 More sharing options...
Danp2 Posted February 18, 2008 Share Posted February 18, 2008 Most scanners are programmable. You should be able to set the scanner to send a Tab (or some other character that you could handle with a hotkey in Autoit) at the end of the string. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
DJ VenGenCe Posted February 20, 2008 Share Posted February 20, 2008 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 More sharing options...
greyhound125 Posted February 21, 2008 Author Share Posted February 21, 2008 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 closedWhile 1$msg = GUIGetMsg()If $msg = $GUI_EVENT_CLOSE Then ExitLoopWendFunc enterfunc() Send("{TAB}")EndFuncThanks 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 More sharing options...
James Posted February 21, 2008 Share Posted February 21, 2008 Some barcode scanners have DLLs which can be used with AutoIt, so when scanned you could make it draw labels to represent the barcode. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
ResNullius Posted February 22, 2008 Share Posted February 22, 2008 (edited) 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: expandcollapse popupOpt("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 February 22, 2008 by ResNullius Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now