OnComm event with JavaScript doesn't fire

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roman Bystrianyk

    OnComm event with JavaScript doesn't fire

    I'm trying to get a comm port working from a javascript using an
    ActiveX control. The port is basically working where I can receive
    input from the serial port. BUT - I can't seem to get the OnComm
    event working so can receive the incomming characters async - any
    ideas????

    Thanks!
    Roman

    var MSComm1 = new ActiveXObject(" MSCOMMLib.MSCom m");

    function onTextClick() {
    view.beginAnima tion(doRotation , 0, 360, 500);

    MSComm1.CommPor t = 1;

    if (MSComm1.PortOp en == false)
    {
    MSComm1.Setting s = "57600,n,8, 1"
    MSComm1.SThresh old = 1;
    MSComm1.RThresh old = 1;
    MSComm1.RTSEnab le = 1;
    // MSComm1.InBuffe rSize = 1;
    MSComm1.InputLe n = 1;
    MSComm1.InputMo de = MSComm1.comInpu tModeText;
    MSComm1.PortOpe n = true;
    }

    msg = "Test Message ";
    // MSComm1.Output = msg;
    msg = MSComm1.Input;

    while(msg == "")
    {
    msg = MSComm1.Input;
    }

    alert(msg);

    // MSComm1.PortOpe n = 0;
    // MSComm1.AboutBo x();
    }

    function MSComm1_OnComm( ){

    alert("onComm") ;

    }

    function doRotation() { mylabel.rotatio n = event.value; }
  • dmark@cinsoft.net

    #2
    Re: OnComm event with JavaScript doesn't fire

    On Nov 20, 4:03 pm, Roman Bystrianyk <rbystria...@gm ail.comwrote:
    I'm trying to get a comm port working from a javascript using an
    ActiveX control.  The port is basically working where I can receive
    input from the serial port.  BUT - I can't seem to get the OnComm
    event working so can receive the incomming characters async - any
    ideas????
    >
    Thanks!
    Roman
    >
    var MSComm1 = new ActiveXObject(" MSCOMMLib.MSCom m");
    >
    function onTextClick() {
      view.beginAnima tion(doRotation , 0, 360, 500);
    >
            MSComm1.CommPor t = 1;
    >
            if (MSComm1.PortOp en == false)
            {
                    MSComm1.Setting s = "57600,n,8, 1"
                    MSComm1.SThresh old = 1;
                    MSComm1.RThresh old = 1;
                    MSComm1.RTSEnab le = 1;
            //      MSComm1.InBuffe rSize = 1;
                    MSComm1.InputLe n = 1;
                    MSComm1.InputMo de = MSComm1.comInpu tModeText;
                    MSComm1.PortOpe n = true;
            }
    >
            msg = "Test Message ";
    //      MSComm1.Output = msg;
            msg = MSComm1.Input;
    >
            while(msg == "")
            {
            msg = MSComm1.Input;
            }
    >
    alert(msg);
    >
    //      MSComm1.PortOpe n = 0;
    //      MSComm1.AboutBo x();
    >
    }
    >
    function MSComm1_OnComm( ){
    This isn't VB. See if the object has an oncomm property. If so, set
    it to reference this function.

    Comment

    Working...