Characters to Com Port
Moderators: Dorian (MJT support), JRL
Characters to Com Port
How does one send characters to a com port using the Macro Scheduler scripting language?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Use VBScript's FileSystemObject, specify the port name and just treat it like a text file. Simple example:
VBSTART
Sub SendData(device,data)
Set fs=CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(device,True)
a.WriteLine(data)
a.Close
End Sub
VBEND
VBRun>SendData,COM5:,Hello World
Clearly if you are sending a steady stream of data you might be better off with a loop within the VBScript code, or split the code up into a connect function, a close function and a send function.
Hope this helps.
VBSTART
Sub SendData(device,data)
Set fs=CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(device,True)
a.WriteLine(data)
a.Close
End Sub
VBEND
VBRun>SendData,COM5:,Hello World
Clearly if you are sending a steady stream of data you might be better off with a loop within the VBScript code, or split the code up into a connect function, a close function and a send function.
Hope this helps.