I am stuck here but I know there is a way out. The problem is I would like to write a simple program that will send code to a controller from a PC over a serial port. I have already created a script that finds the code and creates a temp copy to send to the machine. So what I want is a program the just simply grabs the temp copy of the code and sends it to the machine. The name of the temp copy is always the same and always in the same directory. I think a full blown DNC software is overkill and really awkward for our operators to use. I found some examples on the internet using NETCommOCX and a visual basic script but when I try to send the program to the controller I get a handshake error. Here is an example of the script I am attempting to use but I do not fully understand it or troubleshoot what might be causing the problem.
Set objComport = CreateObject( "NETCommOCX.NETComm" )
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\turret\program.gcd", 1)
objComport.CommPort = 2
objComport.Settings = "9600,N,8,1"
objComport.RThreshold = 1
objComport.SThreshold = 1
objComport.InputLen = 0
objComport.HandShaking = 3
wscript.sleep(100)
wscript.echo "transmitting"
i = 1
Do Until objTextFile.AtEndOfStream
Redim Preserve arrdata(i)
arrData(i) = objtextfile.ReadLine
i = i + 1
Loop
objTextFile.Close
objComport.PortOpen = False ' Close the port
Set objComport = CreateObject( "NETCommOCX.NETComm" )
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\turret\program.gcd", 1)
objComport.CommPort = 2
objComport.Settings = "9600,N,8,1"
objComport.RThreshold = 1
objComport.SThreshold = 1
objComport.InputLen = 0
objComport.HandShaking = 3
wscript.sleep(100)
wscript.echo "transmitting"
i = 1
Do Until objTextFile.AtEndOfStream
Redim Preserve arrdata(i)
arrData(i) = objtextfile.ReadLine
i = i + 1
Loop
objTextFile.Close
objComport.PortOpen = False ' Close the port