By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,932 Members | 1,291 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,932 IT Pros & Developers. It's quick & easy.

OnComm event with JavaScript doesn't fire

P: n/a
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; }
Nov 20 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Nov 20, 4:03*pm, Roman Bystrianyk <rbystria...@gmail.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.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.

Nov 20 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.