AhGohGoh Posted December 30, 2022 Share Posted December 30, 2022 Hi! I am new to AutoIt. I am working on a project. There is a program call "Production" where we use barcode scanner to scan our Job Number which is in barcode format to "check-in" into the multi-coat department. Our customer service are able to check the job process status then. We have 3 types of multi-coat. My intention is to create a hidden form (in system tray) to listen to barcode scanner input whenever this "Production" window is active. I will use this input to check from our database server for the type of multi-coat to help them to separate type of multi-coat by playing different sounds. AutoIt Window Info unable to get the controlname for the textbox which forcing me to listen to barcode scanner input. I have did search and tried on RawInput.au3 but don't know how and unable to get the input from barcode scanner. My barcode scanner is Symbol LS2208 UBS type. Can someone help me with example how to listen? I only need to listen when the "Production" program is active. I understand that it like keylogger but I swear I am not using it for hacking. Thank you in advance. Link to comment Share on other sites More sharing options...
Nine Posted December 30, 2022 Share Posted December 30, 2022 (edited) Why did you put it in AutoItX ? You should ask a mod to move it to GH&S, I believe. Do you see your barcode scanner as a device when you use _WinAPI_EnumRawInputDevices ? It is suppose to emulate keyboard entry when you scan a bardcode, right ? If so can you scan a few barcodes, put it in Notepad, save it to file and post the file.txt here so we can see what the messages looks like. Edited December 30, 2022 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Link to comment Share on other sites More sharing options...
AhGohGoh Posted December 31, 2022 Author Share Posted December 31, 2022 Thank you for your response @Nine. I have to say sorry first as I am not a "qualified" programmer. I learn programming by myself as a habit and I am using my working environment as an opportunity to try out my programming skill. Due to that, I don't understand the meaning of "ask a mod to move it to GH&S". However, I will google for the meaning. Come back to topic. I use below code to check the device: #include <APISysConstants.au3> #include <Array.au3> #include <WinAPISys.au3> Local $tText, $aData = _WinAPI_EnumRawInputDevices() If IsArray($aData) Then ReDim $aData[$aData[0][0] + 1][3] $tText = DllStructCreate('wchar[256]') For $i = 1 To $aData[0][0] If _WinAPI_GetRawInputDeviceInfo($aData[$i][0], $tText, 256, $RIDI_DEVICENAME) Then $aData[$i][2] = DllStructGetData($tText, 1) Else $aData[$i][2] = '' EndIf Next EndIf _ArrayDisplay($aData, '_WinAPI_EnumRawInputDevices') And my barcode scanner device is #1 (See below). For the requested barcode text file as attached. I also snipped few barcode for your reference, if needed. Thank you again. file.txt Link to comment Share on other sites More sharing options...
Nine Posted December 31, 2022 Share Posted December 31, 2022 Interesting. Your device is considered as a keyboard from the system. So it will be very easy to identify what is the input from the barcode device and the real keyboard. I understand that you are not familiar with programming but you can look at my signature to find a UDF called Multi-keyboard HotkeySet. You can start with this code to find how to differentiate a key entered from one of the 2 devices. You cannot use my UDF directly, but the code inside is pretty much what you need. Now, you must understand that we are not here to write code for people We are here to help people when they have issue with their code. So put something together and come back with the code that is not working. Please when you post code, use the appropriate way as described in the link. ps. "ask a mod to move it to GH&S" means that you posted your request in the wrong forum. In full work, it means "Ask a moderator ( @Jos @Melba23 ) to move your thread into General Help and Support Forum", since your request has nothing to do with AutoItX. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Link to comment Share on other sites More sharing options...
AhGohGoh Posted December 31, 2022 Author Share Posted December 31, 2022 Thank you for your prompt. I will try it out. ps: thanks for the explanation too. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 31, 2022 Moderators Share Posted December 31, 2022 Thread moved. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
rudi Posted January 2 Share Posted January 2 A barcode scanner basically is a keyboard, so "listening" to a barcode scanner is technically a key logger. Pls read up the Forum rules which explicitly prohibit this. Technically (if you already know how to "listen" to your barcode scanner) it's quite easy to catch barcode scanner input, as all barcode scanners send their data at a fixed rate of "keys-per-second" and no human input will ever provide the same and constant key rate per second. But to fill in the barcode scanner input to a certain input box or edit, all you need is to put the focus on that control and then scan the barcode. Then the input will be filled into that control or edit. Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
AhGohGoh Posted January 3 Author Share Posted January 3 Thanks @rudi for your reply. I'm still struggling on the "listening" function. My plan is: if WinActive("Production") Then $bBarcode=ListenToBarcodeScannerInputData $mMulticoat= SqlQueryForMultiCoatType($bBarcode) If $mMulticot="Green" Then Play"GreenSound" Endif If $mMulticot="Blue" Then Play"BlueSound" Endif If $mMulticot="Drive" Then Play"DriveSound" Endif EndIf loop again I'm fully understand "Listening" is a key logger. But I need "this" to do some control and sorting as our workers facing more than 1000 jobs per day and human make errors. I just wish to cut down the errors. I have successfully did the other way round where I created an input form using AutoIt. Then I will use sendkey to copy the input and paste to the "Production" form and sendkey "Enter" at "STATUS4". (Please see above picture). But now our Production Manager has changed the "Production" screen as below for batch control purpose. That is why I need to use the "Listen" function. Any tips on the "Listening". I just need this one "$bBarcode=ListenToBarcodeScannerInputData". Thank you again Link to comment Share on other sites More sharing options...
Nine Posted January 3 Share Posted January 3 To be honest, I do not understand what is the issue you are having. In the form you posted, there is input fields containing SCANJOBNUMBER. Why don't you put the barcode scan directly into those fields ? One thing I believe is that you do not need to read raw input data (way an overkill). You just need to use an input (or edit) field to receive the scan code... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Link to comment Share on other sites More sharing options...
AhGohGoh Posted January 4 Author Share Posted January 4 Sorry. My bad. I don't stated clearly. The form with "SCANJOBNUMBER" is not created by me. It is the "Production" program form, which I don't have the textbox controlname. (I have tried to use AutoIt Windows Info to scanned it but no info on the textbox). My company is producing spectacle lenses (in our industry we are called RX Lab). In the Multi Coat Department, we are processing (or coating) 100 pieces of lenses per batch and our production manager using the (A), (B), (C), (D)....... to identify which processing batch of a lens for troubleshooting purpose, if required later. Each order normally contains 2 lenses (Right & Left for both eyes). But sometime an order may only contain 1 lens (either Right or Left eye). (At this stage, I don't want to use AutoIt to do the counting (100 pieces) as there is other criteria affecting the counting, Example product "Reject" or "Damage". ) So for the moment, I just let the workers to select (A), (B), (C), (D)...... manually. My planed is to "Listen" to the barcode scanner input and help them do the sorting using sound. p/s: When Multi Coat Department received the lenses from previous departments, they are not sorted. It is alright if you understand me. I will try to find the how to "Listen". Link to comment Share on other sites More sharing options...
rudi Posted January 5 Share Posted January 5 As @Nine already suggested, the best way is to put the string coming from the scanner directly into the appropriate control. What do you see with the Autoit v3 Window Info Tool, when you drag-drop the crosshair to the control you want to select? Possibly the form you are talking about was coded by an inhouse programmer? Then you could ask him to set the control focus to a certain control and then TAB through the controls. Or there is a different possibility to send the input to your ERP system directly, without that form Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
AhGohGoh Posted January 5 Author Share Posted January 5 Hi @rudi, Thank you for your reply. I will look into your advise. Thank you again. 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