Can a 2-D barcode scanner be used with OCR applications?

AI Thread Summary
A user seeks a hand-held scanner to read MAC IDs displayed on a monitor for integration into different applications across Linux and Windows systems. They inquire about the availability of Optical Character Recognition (OCR) in hand-held scanners, suggesting that existing OCR applications could facilitate this task. The discussion highlights the potential of using AutoHotkey to capture text from a DOS box application and transfer it to another program, thus eliminating manual entry errors. Several participants mention the feasibility of using Android OCR apps, but emphasize the need for a solution that can send recognized text to a computer. The conversation concludes with a focus on scripting solutions to automate the process efficiently.
berkeman
Admin
Messages
69,108
Reaction score
24,025
I have a need for a hand-held scanner to be able to read a MAC ID displayed on a monitor. The MAC IDs are sent to my application via a network, and I need to automatically read each MAC ID into a different application. For various reasons (Linux versus Windows applications running on different computers), it would be easiest if I could just use a hand-held scanner to capture the MAC ID into an application.

Has anybody seen Optical Character Recognition (OCR) in a simple hand-held scanner device? I guess I could write my own application based on a cell phone camera or similar, but if such an OCR application exists already for 2-D barcode scanner wands, that would be the quickest way to solve this problem. Thanks.

upload_2018-8-16_8-10-28.png


upload_2018-8-16_8-7-15.png
 

Attachments

  • upload_2018-8-16_8-7-15.png
    upload_2018-8-16_8-7-15.png
    14.6 KB · Views: 742
  • upload_2018-8-16_8-10-28.png
    upload_2018-8-16_8-10-28.png
    228 bytes · Views: 648
Computer science news on Phys.org
I don't know the answer, but I would search for a phone app.
 
Alternatively you could have the computer display a barcode version of the number and then scan it that way.

However, I think @anorlunda's suggestion is the best one.
 
It's to retrofit a manufacturing test fixture in China that has one Windows laptop and one Linux laptop. The MAC ID shows up in a DOS box application on the Windows PC, and we need to enter it into the Linux PC's test program. If the scanner's program could read the MAC ID text displayed in the DOS box and output the characters via USB, that would be ideal (like a barcode scanner just outputs the text version of the barcode, so simple console apps can take the data in).
 
I am pretty sure I saw an Android app for that, capable of scanning the code and transferring it to the computer.
 
Borek said:
I am pretty sure I saw an Android app for that, capable of scanning the code and transferring it to the computer.
Do you mean an app for scanning a barcode or QR code? I use the Android app "QR and Barcode Scanner" for that, and it works okay. But this current requirement is different (recognizing characters and sending them over USB as a text stream).

https://play.google.com/store/apps/details?id=me.scan.android.client&hl=en_US

upload_2018-8-16_10-45-5.png
 

Attachments

  • upload_2018-8-16_10-45-5.png
    upload_2018-8-16_10-45-5.png
    46.6 KB · Views: 724
Sorry, missed the part about the ID being text :frown:

There are OCR apps, but no idea if they can be used to send the ocr-ed text to the computer.
 
If you are writing the application, consider using a pipe between the programs. You can do it at the command level:

MACapp | YourApp

It is slightly more difficult if the apps are on different computers. I guess something like this would need to be prettied up:

MACapp | //YourPC/Appdir/YourApp
 
  • #10
Do you have the ability to install a program on the PC running the DOS box?
Does that PC also have networking capabilities with your linux box?

If so, you can write an AutoHotkey script that can detect the DOS box
then capture the text (as text) then process it (to extract the MAC ID), then send it via the network to your linux box.
No image processing, OCR, or additional hardware is needed.

https://www.google.com/search?q=autohotkey+dosbox+text+capture
https://autohotkey.com/

(along the line of OCR on a smartphone, I think this is pretty neat...
https://www.microsoft.com/en-us/seeing-ai (for iOS)
)
 
  • Like
Likes berkeman
  • #11
berkeman said:
The MAC ID shows up in a DOS box application on the Windows PC, and we need to enter it into the Linux PC's test program
As I recall there was a way to redirect the standard DOS output to serial port, for example.
But it is an old story, and things might be different under a windows console.
 
  • #12
berkeman said:
DOS box application

Is this DOSBox running a DOS application or windows running a DOS application or a windows console application?

BoB
 
  • #13
rbelli1 said:
Is this DOSBox running a DOS application or windows running a DOS application or a windows console application?

BoB
There is a DOS application running in the DOS box that receives a MAC ID over a network (and doesn't have an easy way to pipe that MAC ID to another application). That MAC ID then needs to be printed out on a barcode label via a C++ or C# Windows application. Right now it is typed into the C++ program manually, leading to human error too often. We are just looking for a simple short-term fix before we re-write the old DOS application as a Windows application.
 
  • #14
If the old application is using the console rather than drawing on the screen you should be able to execute the application as a child process and capture the console streams. Then you can parse out the MAC.

BoB
 
  • Like
Likes berkeman
  • #15
I got the following to work.

I installed AutoHotKey ( https://autohotkey.com/ ) on my Windows 10 machine (although I have used an old version of it since Windows XP).
I have a console window on my desktop.
The following script does the following steps:
When ctrl-shift-q is pressed,
if a window with the title Command Prompt exists [and I am assuming that it's a console window],
it clicks the upper left corner of the window, hits (e)dit, then mar(k).
It clicks in the client region [where the text is visible] at the upper-left corner of the console.
Then either
  • Method 1:
    It sends ctrl-a, then hits ENTER.
    The entire console buffer is captured into the clipboard as text.
  • Method 2:
    Starting from a point near the click, it click-drags to the opposite corner of the console window
    then hits ENTER.
For the purposes of this demo, the clipboard will display in a Message Box... but you don't need to.
AutoHotKey can now process the text (search for a MAC address, if you teach it to),
and then do something [like write a file, or possibly send an email, etc...]

Rather than hit a keystroke (like ctrl-shift-q),
a script can watch for a window (or some other condition), then continue when it is found.
https://autohotkey.com/docs/commands/WinWait.htm

You can also just loop and keep checking at some interval you set.
Code:
^+q::
IfWinExist, Command Prompt
{
    WinActivate
    Click,20,10
    Send,e
    Sleep,200
    Send,k
    Click,10,40
    SLeep,500

    if 1
    {
        Send,^a{ENTER}
    }
    else
    {
        ;;;method2
        WinGetPos,X,Y,W,H, Select Command Prompt ; title changed after 500ms since the click
        Sleep,200
        MouseClickDrag, left, 12,40, W-50,H-50,0 ; 0=fastest, 100=slowest
        Send,{ENTER}
    }
    MsgBox ,  %clipboard%
}
return

AutoHotKey can be installed on the computer running the DOSbox.
However, you can also install AutoHotKey on another computer, then get AutoHotKey to compile the script into an executable.
That executable can be copied to the computer running the DOSbox and should be able to run without installing AutoHotKey on it.

https://autohotkey.com/docs/commands/RegExMatch.htm
https://autohotkey.com/docs/commands/SubStr.htm
https://autohotkey.com/board/topic/123886-send-email-from-script/
 
Last edited:
  • Like
Likes sysprog, berkeman and jim mcnamara
Back
Top