How to get Zbar to Paste recognized QR Code?

Help
Nico Maas
2010-07-10
2013-09-29
  • Nico Maas

    Nico Maas - 2010-07-10

    Hello!

    I recently discovered ZBar as I was looking for an QR Code Reader which could be used with an Webcam. And I must say, I'm very glad - I was looking the whole day for something like it - and found it out to be the best - but I would really need one option: To paste the recognized QR Code to the active Window (Under Windows XP) into the active Textfield.

    I plan on using ZBar and some than to be custom Made "WebcamBarcodeReaderwithLight"™ ( ;-))  as QR Code Reader for an Ticket System. The user should be able to go to the terminal, just scan his Ticket, the ZBar should recognize it via the Webcam and paste the Code into an active Field on an open PHP Website. That website does recognize the Code and validates it (or not, if the Ticket is manipulated or cloned..). But problem is, I haven't found any of this features yet in the Windows Version of ZBar.

    For just getting something running, I grabbed the Source Code of an VB6 Output Parser for Dos Appliances and modified it in that way that it can accomplice the needed feature - sadly its so badly written and overloaded that it will just crash every minutes or so - or just stop working, shutting down ZBar as well…

    So, could somebody help me out and tell me what to?

    Thank you all very much!!!

    Nico

     
  • spadix

    spadix - 2010-07-11

    Nico-

    You should be able to find software that copies standard input to the specified window (or the clipboard) and just pipe the output of zbarcam into it.  eg, for linux we can use xvkbd

    fwiw- we will eventually get a real gui that supports these operations natively

     
  • Nico Maas

    Nico Maas - 2010-07-11

    Hi spadix,

    Thanks for your Answer.
    I did try this yesterday in multiple versions and it just didn't work out or became very unstable because of "hardwiring" the console output via an pipe loop to VB6. (and because of that loop that never finished, the software became very instable and crashed - actually after not less than half an minute it already froze, and after 1-2 minutes windows did kill it itself)…

    I did also try various redirects in the DOS Box itself - piping > or >> to an text file and making my software read the file every some seconds and than paste it to active window is very ugly and does slow down the recognition process.

    Using "Clip" (some software that does take the piped info and copies it to clipboard) did not work at all - no reason given her why. (but I saw in the vb6 output that there was an NewLine and other LineFeed at the End of every code… maybe that messed up - even if I choose raw output mh…

    So, question: I have some code in VB6 with which I can paste text into an active window.
    Is there some way in compiling it and adding it to VB6 so it can be called from there, just spiting out the found codes (so never quit, just keep on scanning and outputing the raw data…)?

    Thanks for your time, I appreciate it!!!

    Nico

    So, if that function can't be implemented in time

     
  • spadix

    spadix - 2010-07-11

    > became very unstable because of "hardwiring" the console output via an pipe loop

    There is nothing inherently unstable about a pipe - you should probably check your code…

    > piping to an text file and making my software read the file every some seconds

    I wouldn't recommend that either…

    > Is there some way in compiling it and adding it to VB6

    ZBar is a library, contained in a DLL.  If VB6 can access the DLL, you can use the interfaces directly from your application, similar to what we do from Python or Perl.  I know nothing about "VB6", so you're on your own there…

     
  • Nico Maas

    Nico Maas - 2010-07-11

    > became very unstable because of "hardwiring" the console output via an pipe loop There is nothing inherently unstable about a pipe - you should probably check your code…

    That wasn't a real pipe. Its more of an Stream as it seems… Mh…

    > ZBar is a library, contained in a DLL. If VB6 can access the DLL, you can use the interfaces directly from your application, similar to what we do from Python or Perl. I know nothing about "VB6", so you're on your own there…

    Visual Basic Version 6, sorry that I didn't make this more clear. Thats the Version before Microsoft started with their .NET Hype. I could also use Dev C++, but only know a bit C Code. Will the Webcam be called from the ZBar Library itself or do I have to "attach" it somewhere in my Programm to the DLL? Is there somekind of precompiled Win DLL and an Example C Code avaiable?

    Thank you very much Sir!

     
  • spadix

    spadix - 2010-07-11

    > Visual Basic Version 6

    Sorry, I dunno anything about Visual Basic (any version).

    > Will the Webcam be called from the ZBar Library itself
    > or do I have to "attach" it somewhere in my Programm to the DLL?

    I don't understand the question…  Your application calls a DLL API to open the camera and display the window.

    > Is there somekind of precompiled Win DLL

    You're running it with zbarcam, it's in the bin/ directory

    > Example C Code avaiable?

    Programming examples are on the wiki.  Most likely you want the "Processor" interface…

     
  • Nico Maas

    Nico Maas - 2010-07-11

    Thank you for your patience, I now did try the whole day but didn't came to any result.
    So I do rephrase the Question to anyone reading this:
    Could somebody please help me out with what to do to create an Application in Windows that just does paste the recognized Code from ZBar Webcam into the active Window? That would be all, nothing more, nothing less.
    Please.

    Thank you very much…

     
  • Nobody/Anonymous

    i need the same…i am not looking to program just to get the oputput into a text file…

     
  • Tony Witte

    Tony Witte - 2010-12-21

    Nico,
    Have you found an answer for pasting barcode into window app field?  That is the function I am looking for also. Please let me know if solved.  Thanks!

     
  • Nobody/Anonymous

    No, I just did transfer it to a text file.
    Never found an solution for that.
    sorry.

     
  • Nobody/Anonymous

    I would simply use python example of zbar to print the qr code data into a file, then use wget (for windows) to get it to the server to be validated. You can have on the Desktop the zbar window next to a browser window. Nicer of course with pyGTK… ( I am not following this thread)

     
  • Jo

    Jo - 2013-09-29

    Hurra, when I close the zbarcam.exe window the scanned ISBN codes are in the clipboard, now. I have Windows 8 Pro (64-bit).

    My Zbar.bat looks like this

    @set PATH=%PATH%;C:\Program Files (x86)\ZBar\bin
    @echo This is the zbarcam output window.
    @echo Hold a bar code in front of the camera (make sure it's in focus!)
    @echo and decoded results will appear below.
    @echo.
    @echo Initializing camera, please wait...
    @echo.
    @zbarcam.exe --prescale=640x480 --raw |@Clip
    @if errorlevel 1 pause

    I hope this can help, too.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks