Using a Windows 7 Intel machine and the following code causes ttmacro.exe to hang at the 'connect' command every now and then. In each hanging case, the macro is started in a Tera Term window that is open and connected to a COM port. When the macro is mid-hang, the macro window shows the command being executed is 'connect COMPort'. I am able to communicate with desired COM in the Tera Term window (such as send and receive data over the COM) as if the connect command completed successfully, but the next command (closesbox) does not execute.
The behavior is similar to the macro being disconnected from the Tera Term window and becoming unresponsive.
NEW_COM="COM2"
do while 1
strcompare NEW_COM "COM5"
if result == 0 then
NEW_COM="COM6"
else
NEW_COM="COM5"
endif
; Disconnect from current host/COM port
gethostname hostname
dispstr '[MACRO:Disconnecting from 'hostname']'
disconnect 0
; random pause necessary to give Tera Term time to think.
pause 1
; figure out the command line format from the given COMx format
i=0
maxCOMs=32
while i<=maxCOMs
sprintf 'COM%d' i
strcompare NEW_COM inputstr
if result = 0 then
; Found the correct COM port, put the command line arguments together
sprintf2 COMPort '/C=%d /timeout=5' i
break
else
i = i + 1
endif
endwhile
; If we never found the correct COM port, error out/user intervention
if i>maxCOMs then
sprintf2 msg 'Could not correlate given COM port to a command line format: %s\n' NEW_COM
strconcat msg 'Please make sure the Manufacturing Test Team is aware of this error occuring"\n'
strconcat msg 'In the mean time, connect manually by going to "Setup -> Serial port..."\n'
strconcat msg 'Press "OK" when complete'
strspecial msg
messagebox msg 'Invalid COM Port'
gethostname hostname
dispstr '[MACRO:User connected to 'hostname']'
exit
endif
sprintf2 msg 'Connecting to new port with argument(s): %s\n' COMPort
strconcat msg 'If this window stays open long enough for you to read this,\n'
strconcat msg 'then select File -> Disconnect and follow the next pop-up window instructions.'
strspecial msg
statusbox msg "Connecting to new COM"
connect COMPort
closesbox
if result = 2 then
dispstr '[MACRO:Connected to 'NEW_COM']'
elseif result = 1 then
sprintf2 msg 'Could not automatically connect to %s\n' NEW_COM
strconcat msg 'Please connect manually by going to "Setup -> Serial port..."\n'
strconcat msg 'Press "OK" when complete'
strspecial msg
messagebox msg 'Connection Problem'
gethostname hostname
dispstr '[MACRO:User connected to 'hostname']'
endif
; random pause necessary to give Tera Term time to think.
mpause 20
clearscreen 0
endwhile
Using a Windows 7 Intel machine and the following code causes ttmacro.exe to hang at the 'connect' command every now and then. In each hanging case, the macro is started in a Tera Term window that is open and connected to a COM port. When the macro is mid-hang, the macro window shows the command being executed is 'connect COMPort'. I am able to communicate with desired COM in the Tera Term window (such as send and receive data over the COM) as if the connect command completed successfully, but the next command (closesbox) does not execute.
The behavior is similar to the macro being disconnected from the Tera Term window and becoming unresponsive.