Accessing the Line Scanner in IBM Anyplace Kiosk

The last week I was busy searching a way to access the integrated Line Scanner as found in the IBM Anyplace Kiosks. The biggest hurdle was actually to get the damn thing to work, after reading through various documentation (JavaPOS, OPOS, UnifiedPOS), installing different devices drivers, I finally succeeded with a OPOS based Windows solution. I still try to convince management to deploy a Linux based solution, but do not yet know if there are the needed device drivers available. IBM seems to support it with IRES, we will see.

So the next step was to actually program the scanner in order to receive data. Since our “application” runs within a browser I had to use ActiveX and JScript to access the scanner. During coding this I learned that in order to capture ActiveX Events one has to use a slightly different event handling technique. I eventually got it to work with the code below.

<object classid="clsid:CCB90182-B81E-11D2-AB74-0040054C3719" id="Scanner" width="39" 

<script type="text/jscript" language="JScript">

onload = function(){
    MyScanner = function(){

        var scanner = Scanner;
        var dc = ec = function(){};

        /* see the following msdn-link for further 
         * information on why this strange syntax actually works.

        function Scanner::DataEvent(){
            scanner.DataEventEnabled = true;

        function Scanner::ErrorEvent(ResultCode, ResultCodeExtended, 

ErrorLocus, ErrorResponse){
            ec(ResultCode, ResultCodeExtended, ErrorLocus, 


        var open = function(devname){
                return false;
            return true;

        var enable = function(devname){
                return false;
                return false;
            scanner.DeviceEnabled = true;
            scanner.DataEventEnabled = true;
            scanner.DecodeData = true;
            return true;

        return {
            init : function(devname,datacb,errorcb){
                    return false;
                if(typeof datacb == "function")
                    dc = datacb;
                if(typeof errorcb == "function")
                    ec = datacb;
                return true;
            close : function(){
                return !scanner.Close();


    var status = MyScanner.init("LineScanner",function(v){ 
            alert("scanner " + v) 

        alert("could init");

onunload = function(){


An important point I would like to note is that only one application can access the scanner at the same time. Which means we must always call close to release the internal handle.

Hope this is useful for somebody.