Connecting Tech Pros Worldwide Help | Site Map

OnComm event with JavaScript doesn't fire

Roman Bystrianyk
Guest
 
Posts: n/a
#1: Nov 20 '08
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.MSComm");

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

MSComm1.CommPort = 1;

if (MSComm1.PortOpen == false)
{
MSComm1.Settings = "57600,n,8,1"
MSComm1.SThreshold = 1;
MSComm1.RThreshold = 1;
MSComm1.RTSEnable = 1;
// MSComm1.InBufferSize = 1;
MSComm1.InputLen = 1;
MSComm1.InputMode = MSComm1.comInputModeText;
MSComm1.PortOpen = true;
}

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

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

alert(msg);

// MSComm1.PortOpen = 0;
// MSComm1.AboutBox();
}

function MSComm1_OnComm(){

alert("onComm");

}

function doRotation() { mylabel.rotation = event.value; }
dmark@cinsoft.net
Guest
 
Posts: n/a
#2: Nov 20 '08

re: OnComm event with JavaScript doesn't fire


On Nov 20, 4:03*pm, Roman Bystrianyk <rbystria...@gmail.comwrote:
Quote:
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.MSComm");
>
function onTextClick() {
* view.beginAnimation(doRotation, 0, 360, 500);
>
* * * * MSComm1.CommPort = 1;
>
* * * * if (MSComm1.PortOpen == false)
* * * * {
* * * * * * * * MSComm1.Settings = "57600,n,8,1"
* * * * * * * * MSComm1.SThreshold = 1;
* * * * * * * * MSComm1.RThreshold = 1;
* * * * * * * * MSComm1.RTSEnable = 1;
* * * * // * * *MSComm1.InBufferSize = 1;
* * * * * * * * MSComm1.InputLen = 1;
* * * * * * * * MSComm1.InputMode = MSComm1.comInputModeText;
* * * * * * * * MSComm1.PortOpen = true;
* * * * }
>
* * * * msg = "Test Message ";
// * * *MSComm1.Output = msg;
* * * * msg = MSComm1.Input;
>
* * * * while(msg == "")
* * * * {
* * * * msg = MSComm1.Input;
* * * * }
>
alert(msg);
>
// * * *MSComm1.PortOpen = 0;
// * * *MSComm1.AboutBox();
>
}
>
function MSComm1_OnComm(){
This isn't VB. See if the object has an oncomm property. If so, set
it to reference this function.

Closed Thread


Similar JavaScript / Ajax / DHTML bytes