Scripting RS232 Communication
Dim objTest
Dim objFSO
Dim objLogFile
Dim s
Dim path
Dim msg
Dim flag
Dim rxCnt
Dim rxBuf
Dim i
logfile = '\log.txt'
MyPort = 1
MyBaud = '57600'
MyThreshold = 6
comEvSend = 1
comEvReceive = 2
comEvCTS = 3
comEvDSR = 4
comEvCD = 5
comEvRing = 6
comEvEOF = 7
comInputModeText = 0
comInputModeBinary = 1
flag = 0
rxCnt = 0
PORT = 'COM1'
ShowMessage('Ready to start exposure')
fso = CreateObject('Scripting.FileSystemObject')
com = fso.OpenTextFile('COM1')
do while com.AtEndOfStream <> True
ShowMessage(listFile.ReadLine)
loop
com.Close()
ShowMessage('Shutter closed.')
' objFSO = CreateObject('Scripting.FileSystemObject')
' path = objFSO.GetAbsolutePathName ('c:')
' objLogFile = objFSO.CreateTextFile(path & logfile, True)
' objTest = CreateObject('MSCOMMLib.MSComm')
' , 'MSCommEvent_OnComm')
' objTest.CommPort = MyPort
' objTest.InputLen = 0
' objTest.InputMode = comInputModeText
' objTest.RThreshold = 2
' objTest.PortOpen = TRUE
' s = MyBaud & ',n,8,1'
' objTest.Settings = s
' msg = 'Test Message '
' objTest.Output = msg
' While flag = FALSE
' Wscript.Sleep (1000)
' Wend
' objLogFile.Close
' objTest.PortOpen = FALSE
' Wscript.DisconnectObject objTest
' Wscript.DisconnectObject objFSO
' Wscript.DisconnectObject objLogFile
' Set objTest = Nothing
' Set objFSO = Nothing
' Set objLogFile = Nothing
ShowMessage('Script completed.') |