Jump to content

input with special characters


Recommended Posts

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 post
Share on other sites

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.

Link to post
Share on other sites

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 post
Share on other sites

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 by TheXman
Link to post
Share on other sites

looks like it is simply missing.

original:
25131642220321V/00000-123458200CZ75_SP-01240CZ75_SP-01_BOA8111001231200004863130000009
pasted: 
0x3235313331361D3432323230331D3231562F30303030302D31323334351D38323030435A37355F53502D30311D323430435A37355F53502D30315F424F411D38313131303031321D3331323030303034383633313330303030303039
scanenr written:
0x3235313331363432323230333231562F30303030302D313233343538323030435A37355F53502D3031323430435A37355F53502D30315F424F4138313131303031323331323030303034383633313330303030303039

 

Link to post
Share on other sites
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.

Link to post
Share on other sites
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 post
Share on other sites

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:

image.png.52b3df661fd0b4ba0cc4718d981cde40.png

 

Edited by TheXman
Link to post
Share on other sites

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 by TheXman
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...