I may be grasping for the moon here, but this is my goal. I have an MIS program for our jobs and we are looking to use a scanner to scan the job ticket and launch the program.

I don't know very much about Python or program coding. My background is web dev, but I learn fast and really, coding is coding. Different types simply have different rules/languages for going "if this then do this". I know it's more complex than that, but that's the simplified way of looking at it.

I came up with a solution here: Industrial Handheld QRCode Scanner Open URL in Browser that uses the web based version of the software, but that is not what the boss wants.

What he wants is this:

  1. Scan barcode
  2. Program auto launches (or goes to program if already open)
  3. Auto opens specific area
  4. Auto selects option from top menus
  5. Auto enters data picked up from the scan into empty field
  6. Auto hits "enter" to load specific job
  7. Script resets back to "ready" waiting for next scan

All from scanning the one barcode with no other user interaction.

This will be running on Windows 7 machines. It looks like EvDev might be a good place to start (http://python-evdev.readthedocs.io/en/latest/tutorial.html) but it seems to only have Linux installers.

If someone can at least point in the rough direction, I can probably figure it out. I'm just not sure on how to limit the input to only inputs from the scanner then trigger the code to run, and also, on how to tell it to do certain things within the program.

Thank you for the help!

  • in "2. Program auto launches (or goes to program if already open)" it is not clear whether you are referring to a program which you will code yourself or to a 3rd party app.
    – Mawg
    Commented Jul 7, 2017 at 7:46
  • a 3rd party program. In this case, it was to launch a web browser with a specific address.
    – Alith7
    Commented Jul 7, 2017 at 12:39

1 Answer 1


The first step is generating the QR codes for this you can use a number of libraries - my favourite for this is PyQrCode.

You can decode images using ZBar python bindings but currently there are no ready build binaries for Python 2.7 or 3.5 on pypi - this may change in the near future or you will have to build your own.

There is also a very good article here that covers using a webcam to detect & capture QR codes.

Once you have your QR code decoded you need to find & possibly start the application and transfer the data to it, if the application has an COM interface python can call it directly using comtypes if not there are still some mechanisms that can used.

For limiting the QR codes that it responds to you can use the convention already used for QR codes of prefixing the information with an action tag, e.g. phone numbers are normally prefixed tel:, etc. I would recommend using a similar syntax to to URLs to distinguish actions & fields, e.g. ourtag:anaction?f1=val1;f2=val2 - you can associate the action for ourtag with your program, anaction with which action to perform, f1, etc., would be field identifiers, etc., this is quite simple to parse and then apply.

  • I have that part all set up. We are using handheld 2D USB scanners. And I have the beginnings of the script (see link above) for telling it what to do with the scanned information specific to my application needs. That script works to direct to and launch a URL, but my boss is not happy with that, he wants to go directly into the program and that's where I'm getting stuck. I've found a few help things on launching a program, but i'm not exactly certain how to implement them into the script, or how to tell it what to do once the program is launched.
    – Alith7
    Commented Aug 10, 2016 at 16:57
  • how can I tell if the software has a COM interface?
    – Alith7
    Commented Aug 15, 2016 at 14:44
  • @Alith7 - The only real answer is consult the documentation &/or code of the application - some applications register their COM/OLE interfaces in a manner that can be explored with an Object browser msdn.microsoft.com/en-us/library/exy1facf(v=vs.100).aspx or c:\Python27\Lib\site-packages\win32com\client\makepy.py and see if the application is in the list - if it is select it or ask the company that wrote the software. Commented Aug 15, 2016 at 18:53
  • 2
    Steve, "if the application has an COM interface..." Not all will, so why not simply provide your own app? For automating Windows apps, there is simply nothing to match Auto-it, which can easily handle 2 -> 6 in a few lines of code.
    – Mawg
    Commented Jul 7, 2017 at 7:49
  • @Maug This is an interesting program. this might be a better answer than the rigged way I ended up doing it. I'll have to download it and check it out. Thank you!
    – Alith7
    Commented Jan 29, 2018 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.