I’m not a developer, but I use Tera Term at my company and I’m trying to automate repetitive inputs in a simple way. I created a TTL file with Notepad and wrote the following code. Everything works fine except the part where I use connect '/C=x'. It doesn't trigger any error message; it just doesn't work. What could be the cause of this, and how can I fix it? I am using version 4.106.
inputstr = ""
com_port = 0
:COM_PORT_SELECTION
inputbox inputstr 'COM 포트 선택: 3 or 5 입력' '' 0
str2int com_port inputstr
if com_port = 3 then
connect '/C=3'
elseif com_port = 5 then
connect '/C=5'
else
messagebox '입력 오류: 3 or 5 입력' '입력 오류' 4
goto COM_PORT_SELECTION
endif
inputstr = ""
mpause 100
setbaud 115200
mpause 100
sendln 'passwd'
sendln 'rocauto!'
sendln '! com'
sendln '2'
sendln '! eng'
sendln '3'
sendln '! reg'
; no : region
; ------------------------------------------
; 1 : 지역 없음
; 2 : 서울
; 3 : 경기
; 4 : 충청
; 5 : 경상
; 6 : 전라
; 7 : 울산
; 8 : 광주
; 9 : 인천
; 10 : 제주
; 11 : 대전
; 12 : 강원
; 13 : 부산
; 14 : 대구
; 15 : 기타지역
sendln '3'
sendln '! sn'
inputbox inputstr '시리얼 번호(sn): 4자리 숫자' '' 0
sendln inputstr
sendln '! ver'
sendln '1204'
sendln 'info'
sendln 'sw'
mpause 100
disconnect
end
Since I’m not very familiar with TTL, I tried modifying the code based on what ChatGPT suggested and the Tera Term help documentation, but that part still doesn’t work.
To automatically set the COM port number in a Tera Term macro, use the COMx command, where x represents the desired port number. You can also retrieve the available COM port dynamically by using the getserial function.