Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

obj event for loop?

Status
Not open for further replies.

bct10

Technical User
May 3, 2004
37
US
hi all how would i do a for loop for obj event in vbs
that dold be the same as this
//-->
</script>

<script for="NETComm1" event="OnComm()" language="JavaScript">
<!--


if(NETComm1.InBufferCount == 0)
{
//
}
else
{
alert(NETComm1.InBufferCount);
document.serialdata.read_data.value = NETComm1.InputData;
}

</script>
thanks beau
 
Try this.
[tt]
<script for="NETComm1" event="OnComm()" language="vbscript">
<!--
if NETComm1.InBufferCount = 0 then
'do nothing
else
window.alert(NETComm1.InBufferCount)
document.serialdata.read_data.value = NETComm1.InputData
end if
-->
</script>
[/tt]
 
Hi tsuji

here is all of the code

Set netcomm1 = CreateObject ("NETCommOCX.NETComm")
output="fr0;"
rem netcomm1.portopen = false
netcomm1.Settings = "9600,N,8,1"
netcomm1.commPort= 4
netcomm1.Handshaking= 0
netcomm1.InBufferSize = 1024
netcomm1.InputLen = 0
netcomm1.InputMode= 0
netcomm1.NullDiscard= 0
netcomm1.OutBufferSize= 1024
netcomm1.ParityReplace="?"
netcomm1.RTSEnable= -1
netcomm1.DTREnable= -1
netcomm1.RThreshold = 1
netcomm1.RThreshold = 1
netcomm1.PortOpen = True
<script for="NETComm1" event="OnComm()" language="vbscript">
<!--
if NETComm1.InBufferCount = 0 then
'do nothing
else
window.alert(NETComm1.InBufferCount)
document.serialdata.read_data.value = NETComm1.InputData
end if
-->
</script>

i get line 18 char:1
error expected statment what have i missed thanks beau

 
I know nothing about your control, so I can only do my best on heuristic.
[tt]
<script language="vbscript">
dim netcomm1
Set netcomm1 = CreateObject ("NETCommOCX.NETComm")
output="fr0;"
rem netcomm1.portopen = false
netcomm1.Settings = "9600,N,8,1"
netcomm1.commPort= 4
netcomm1.Handshaking= 0
netcomm1.InBufferSize = 1024
netcomm1.InputLen = 0
netcomm1.InputMode= 0
netcomm1.NullDiscard= 0
netcomm1.OutBufferSize= 1024
netcomm1.ParityReplace="?"
netcomm1.RTSEnable= -1
netcomm1.DTREnable= -1
netcomm1.RThreshold = 1
netcomm1.RThreshold = 1
netcomm1.PortOpen = True

sub handler
if NETComm1.InBufferCount = 0 then
'do nothing
else
window.alert(NETComm1.InBufferCount)
document.serialdata.read_data.value = NETComm1.InputData
end if
end sub

set netcomm1.oncomm=getref("handler")

</script>
[/tt]
I feel less comfortable with the construction of script-for-event, in particular when I don't know the control, so I use the above construction. Your original may be fine, I have no opinion against.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top