28
31

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Tera Term マクロ、ログイン先指定で 自動ログインと背景色変更

Last updated at Posted at 2014-03-10

INIファイルを それぞれttpmacro.exeと同じディレクトリにおいて切り替えるだけ
3つ程度なら これでよいが増えた時の修正が面倒かもしれない

;=====================================================================
; 自動ログイン TTL
;=====================================================================
; ホスト設定
strdim HOSTNM 3
HOSTNM[0] = 'ローカル'
HOSTNM[1] = '開発'
HOSTNM[2] = '本番'
strdim HOSTIPLIST 3
HOSTIPLIST[0] = 'XXX.XXX.XXX'
HOSTIPLIST[1] = 'XXX.XXX.XXX'
HOSTIPLIST[2] = 'XXX.XXX.XXX'

; ログインユーザ
strdim USERLIST 3
USERLIST[0] = 'username'
USERLIST[1] = 'username'
USERLIST[2] = 'username'

; ログインパスワード
strdim USERPWLIST 3
USERPWLIST[0] = 'password'
USERPWLIST[1] = 'password'
USERPWLIST[2] = 'password'

; 設定INIファイル
strdim INILIST 3
INILIST[0] = 'ini_local.ini'
INILIST[1] = 'ini_dev.ini'
INILIST[2] = 'ini_system.ini'

;; 接続先ホスト選択
listbox '接続するホストを選択して下さい' '接続ホスト選択' HOSTNM
if result >= 0 then
	HOSTADDR = HOSTIPLIST[result]
	USERNAME = USERLIST[result]
	PASSWORD = USERPWLIST[result]
	INIFILE  = INILIST[result]
else
    end
endif

; コマンド
COMMAND = HOSTADDR
strconcat COMMAND ':22 /ssh /2 /auth=password /user='
strconcat COMMAND USERNAME
strconcat COMMAND ' /passwd='
strconcat COMMAND PASSWORD
strconcat COMMAND ' /F='
strconcat COMMAND INIFILE

; 接続
connect COMMAND

; マクロ終了
end
28
31
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
31

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?