Dynagenのtelnetコマンドをカスタマイズする
Dynagenのtelnetコマンドで、エミュレートしてるRouterに接続することができる。で、やっぱりtelnetは自分好みの方法で起動したいよね?そういう人のために、Dynagenのtelnetはカスタマイズが可能。
カスタマイズはdynagen.iniというファイルを設定することで実施する。/Applications/Dynagen/dynagen.iniが存在するけど、実はこのファイルは使われない。Dynagen.appにContents/Resources/dynagen.iniが含まれていて、こっちが使用される。WindowsならTeraTerm Proでも指定するところだけど、Mac OS Xの場合はApple Scriptを使ったサンプルが記載されてる。
# ----------------------------------------------------------------------------- # telnet option # Specify the command to execute when using the telnet command from the CLI # The following substitutions are performed: # %h = host # %p = port # %d = device name # Uncomment below for OS X with Terminal #telnet = /usr/bin/osascript -e 'tell application "Terminal" to do script with command "telnet%h %p ; exit"' -e 'tell application "Terminal" to tell window 1 to set custom title to "%d"' # Uncomment below of OS X with Terminal with named tabs (requires Leopard) #telnet = /usr/bin/osascript -e 'tell application "System Events" to tell process "Terminal" tokeystroke "t" using command down' -e 'tell application "Terminal" to do script with command "telnet %h %p ; exit" in last tab of first window' -e 'tell application "Terminal" to tell window 1 to set custom title to "%d"' # Uncomment below for OS X with iTerm with named tabs #telnet = /usr/bin/osascript -e 'tell app "iTerm"' -e 'activate' -e 'set myterm to the first terminal' -e 'tell myterm' -e 'set mysession to (make new session at the end of sessions)' -e 'tell mysession' -e 'exec command "telnet %h %p"' -e 'set name to "%d"' -e 'end tell' -e 'end tell' -e 'end tell'
これに限らず、自分で作成してもOK。自分ではiTermで開く最後のscriptを使うことにした。