'
' How To use VBScript with serial communication.
' Save this as test.vbs file
' Run by double-click
'
Dim MSComm
Set MSComm = CreateObject("MSCommLib.MSComm")
MSComm.CommPort = 2
MSComm.PortOpen = True
' send text
MSComm.Output = "otput text to send"
'send binary data
MSComm.Output = GetData(4321) & GetData(0) & _
' How To use VBScript with serial communication.
' Save this as test.vbs file
' Run by double-click
'
Dim MSComm
Set MSComm = CreateObject("MSCommLib.MSComm")
MSComm.CommPort = 2
MSComm.PortOpen = True
' send text
MSComm.Output = "otput text to send"
'send binary data
MSComm.Output = GetData(4321) & GetData(0) & _
GetData(1234) & GetData(0) & GetData(2345)
Function GetData(w)
Dim LoByte,HiByte
LoByte = w And &HFF
HiByte = (w And &HFF00&) \ &H100
GetData = ChrB(HiByte) & ChrB(LoByte)
Function GetData(w)
Dim LoByte,HiByte
LoByte = w And &HFF
HiByte = (w And &HFF00&) \ &H100
GetData = ChrB(HiByte) & ChrB(LoByte)
End Function
1 comment:
Hi, do you need to install anything like MSCOMM32.OCX to do run this script? because i tried to download this and put it at windows/System folder but it still give me error and say that I was unable to open and run the vbscript file
Post a Comment