본문 바로가기
프로그램...

[TTL] TeraTerm MACRO

by 크크다스 2019. 2. 25.
반응형

Total Reference manual> TTL command reference(http://www.teraterm.net/manual/en/macro/command/index.html)

[ Function]

형식>

call func_label


:func_label

......

return


예>

;########## Clear Files

call do_clear_files


fileopen fp list_ip 0


;########## Main End(Exit)

:MainTheEnd

end


;########## Clear Function

:do_clear_files

filedelete list_log

filedelete list_err

return



[ sprintf2 ]

형식>

sprintf2 strvar FORMAT [ARGUMENT ...]

typec, d, i, o, u, x, X, e, E, f, g, G, a, A and s
flags(option)-, +, 0, # and blank(' ')
width(option)decimal integer or *
precision(option)nonnegative decimal integer or *(option), preceded by a period(.)

Please specify the floating point number with the string variable and string because the TTL can not support the floating point number.

As a result of this command, the system variable "result" is set to one of the following values.

ValueStatus
0Formatted successfully
1No format string
2Invalid format
3Invalid argument
4Invalid destnation variable


예>

site = 'SITE'

sprintf2 site_path "%s\%s" 'D:\Firstpw\_HowTo\SCRIPT\TeraTerm' site

sprintf2 list_ip "%s\%s" site_path '_iplist_nested.txt
'


[ wait]

형식>

wait <string1> [<string2> ...]

ValueMeaning
0Timeout. No string has received.
1<string1> has received.
2<string2> has received.
n<stringn> has received. n=1..10.


예>

wait 'yes/no' 'password:'

if result = 0 then ; timeout

sprintf2 str_error "%s|%s|Connection TimeOut."#13#10 site hostname

;messagebox str_error "str_error" 1 ; 1 == special char \n \t \\

 

; SUBs ...................

call do_error_loging

goto cnx_timeout

elseif result = 1 then ; 'yes/no'

sendln 'yes'

wait 'password'

; elseif result = 2 then ; 'password:'

endif

; password

sendln passwd

; SUBs ...................

call do_main_processing

sendln 'exit' ;disconnect 0


[ New Line ]

참고 사이트>

https://ttssh2.osdn.jp/manual/en/macro/appendixes/newline.html


send 시>

You should use the pair (CR+LF) as a new-line character to send to Tera Term.

ASCII code 

#13 : CR

#10 : LF

Ex>

sprintf2 str_error "%s|%s|Link to Tera Term has not been made."#13#10 site hostname


반응형

'프로그램...' 카테고리의 다른 글

[색상] 색의 표현 방식 [펌]  (0) 2019.05.03
[스크립트] Lua  (0) 2019.03.14
[WLAN] 용어사전  (0) 2018.12.17
[무료S/W] 백신  (0) 2018.08.07
[용어] ALC(RFC 3450=>5775 - Asynchronous Layered Coding)  (0) 2017.11.15