renemayer Posted September 25, 2020 Share Posted September 25, 2020 Hi, I am triing to get a barcode scanner to work with autoit inputs. The scanner is a HID device and writes text to an input. The datafields within the string are separated by [GS], chr(29). it the text gets put in by the scanner these charaters are not included. When I paste the scanenroutput from notepad++ to the input, chr(29) is included. what am I missing? Link to comment Share on other sites More sharing options...
TheXman Posted September 25, 2020 Share Posted September 25, 2020 I must be missing something. What about this topic is related to AutoIt other than you mentioning it in the first sentence? Maybe if you post your AutoIt script, it'll be easier to understand what your talking about. From what I'm able to gather, you are wondering how the barcode reader transmits the data it reads. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
renemayer Posted September 25, 2020 Author Share Posted September 25, 2020 The Scanner puts out text like any other HID, if the scanner "writes" to an autoit GUI Input (GUICtrlCreateInput) the character GS is not insertet into the control. If the scanner "writes" into notepad++, the text contains the caracter. If I paste Text from notepad++ into this control, the text also contains the character. To me this is an autoit thing. excerpt: $Input1 = GUICtrlCreateInput("", 8, 16, 585, 21) ... MsgBox(1, StringInStr(GUICtrlRead($Input1), Chr(29))) returns in case of text directly written to it(from the scanner): 0 returns in case of pasted text from notepad(previously written by the scanner): 1 Link to comment Share on other sites More sharing options...
TheXman Posted September 25, 2020 Share Posted September 25, 2020 (edited) Okay, now I understand. Can you try displaying the control's value in binary to see if maybe the separator is being encoded as something other than Chr(29)? Something like: ConsoleWrite(Binary(GUICtrlRead($Input1)) & @CRLF) Please post the result. Edited September 25, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
renemayer Posted September 25, 2020 Author Share Posted September 25, 2020 looks like it is simply missing. original: 25131642220321V/00000-123458200CZ75_SP-01240CZ75_SP-01_BOA8111001231200004863130000009 pasted: 0x3235313331361D3432323230331D3231562F30303030302D31323334351D38323030435A37355F53502D30311D323430435A37355F53502D30315F424F411D38313131303031321D3331323030303034383633313330303030303039 scanenr written: 0x3235313331363432323230333231562F30303030302D313233343538323030435A37355F53502D3031323430435A37355F53502D30315F424F4138313131303031323331323030303034383633313330303030303039 Link to comment Share on other sites More sharing options...
renemayer Posted September 25, 2020 Author Share Posted September 25, 2020 original: 251316[GS]422203[GS]21V/00000-12345[GS]8200CZ75_SP-01[GS]240CZ75_SP-01_BOA[GS]81110012[GS]31200004863130000009 Link to comment Share on other sites More sharing options...
TheXman Posted September 25, 2020 Share Posted September 25, 2020 11 minutes ago, renemayer said: original: 25131642220321V/00000-123458200CZ75_SP-01240CZ75_SP-01_BOA8111001231200004863130000009 Is this ascii value that appears in the input control after being scanned? 12 minutes ago, renemayer said: scanenr written: 0x3235313331363432323230333231562F30303030302D313233343538323030435A37355F53502D3031323430435A37355F53502D30315F424F4138313131303031323331323030303034383633313330303030303039 Is this the binary representation of the input control's value? 14 minutes ago, renemayer said: pasted: 0x3235313331361D3432323230331D3231562F30303030302D31323334351D38323030435A37355F53502D30311D323430435A37355F53502D30315F424F411D38313131303031321D3331323030303034383633313330303030303039 Where did this value come from? Was this scanned into notepad and pasted? I'm just trying to makesure that I understand exactly what I'm looking at and where it came from. CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
renemayer Posted September 25, 2020 Author Share Posted September 25, 2020 4 minutes ago, TheXman said: Is this ascii value that appears in the input control after being scanned? Is this the binary representation of the input control's value? Where did this value come from? Was this scanned into notepad and pasted? I'm just trying to makesure that I understand exactly what I'm looking at and where it came from. yes yes yes Link to comment Share on other sites More sharing options...
TheXman Posted September 25, 2020 Share Posted September 25, 2020 (edited) I don't have a barcode scanner so I'm trying to manually reproduce the issue in AutoIt. Unfortunately, I can't recreate it. Using the example below, when the form is shown, the input has a value of "one[GS]two". You can't see the [GS], because it is unprintable, but it is there as you can see by the console output. If I used a different font, like a raster font, I probably could get it to display in the input control like it does in the console output. #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $Form1 = GUICreate("Form1", 304, 63, 298, 143) Global $Input1 = GUICtrlCreateInput("Input1", 16, 16, 185, 21) GUICtrlSetData($Input1, "one" & Chr(29) & "two") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ConsoleWrite(StringFormat("Text value of $Input1 = %s", GUICtrlRead($Input1)) & @CRLF) ConsoleWrite(StringFormat("Binary value of $Input1 = %s", Binary(GUICtrlRead($Input1))) & @CRLF) Console output: Edited September 25, 2020 by TheXman renemayer 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
renemayer Posted September 25, 2020 Author Share Posted September 25, 2020 yeah.., thanks anyway! guess I need to fiddle around with the clipboard or geta scanner with software which replaces [GS]. TheXman 1 Link to comment Share on other sites More sharing options...
TheXman Posted September 25, 2020 Share Posted September 25, 2020 (edited) By adding in the $ES_OEMCONVERT style to the input control, it shows the separator. #include <Constants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> Global $Form1 = GUICreate("Form1", 304, 63, 298, 143) Global $Input1 = GUICtrlCreateInput("Input1", 16, 16, 185, 21, BitOR($ES_LEFT,$ES_AUTOHSCROLL,$ES_OEMCONVERT)) GUICtrlSetFont(-1, 8, 800, 0, "System") GUICtrlSetData($Input1, "one" & Chr(29) & "two") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ConsoleWrite(StringFormat("Text value of $Input1 = %s", GUICtrlRead($Input1)) & @CRLF) ConsoleWrite(StringFormat("Binary value of $Input1 = %s", Binary(GUICtrlRead($Input1))) & @CRLF) Edited September 25, 2020 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
renemayer Posted September 25, 2020 Author Share Posted September 25, 2020 good find, sadly the scanner does not put it into the input or inputbox. thanks for your help again. Link to comment Share on other sites More sharing options...
Danp2 Posted September 25, 2020 Share Posted September 25, 2020 I wonder if you could read the incoming data using _WinAPI_GetRawInputData? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
renemayer Posted September 29, 2020 Author Share Posted September 29, 2020 it sort of works, but I get different values from DllStructGetData(). [GS] /chr(29) is now DC1 /chr(17) and other charaters are off aswell. No matter which codepage is set. 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