現在、特定の単語 (大きな文字列) を待ちたい teraterm スクリプトを実行しています。単語が見つかった場合はコマンドを実行し、見つからない場合は別のコマンドを実行します。wait と if_else を使用しようとしましたが、うまくいきません。助けてください。
5059 次
3 に答える
3
あなたの質問に基づいて、if_elseを使用せずに正しい解決策を達成できると信じています。私は 1 週間前に teraterm でスクリプトを作成したばかりで、これまでの経験と知識は COM ポート通信に関するものです。たとえば、ログインするためのコード スニペットを示します。
;Set the COM port
connect '/C=5'
;Set Baud rate
setbaud 9600
;Set the display
showtt 1
;Set the timeout in seconds and result
timeout = 10
result = 1
;Set the username and password's prompt and value
UsernamePrompt='login:'
PasswordPrompt='Password:'
Username='admin'
Password='mypasword'
;Wait for the UsernamePrompt
wait UsernamePrompt
;If timeout occurs, result will be 0, else, result will be 1
if result = 0 goto Error
if result = 1 goto Ok
:Error
;Do the processing here if timeout occurs
:Ok
;Do the processing here if UsernamePrompt is received
sendln Username
これがあなたを助けると信じています。タイムアウトと 待機 については、https : //ttssh2.osdn.jp/manual/en/macro/command/wait.html を参照してください。
良い1日を。
ハリ
于 2017-03-16T07:05:39.670 に答える
1
私の実験と同様に、大きな文字列を扱う場合でも waitln を使用できることがわかりました。私は、waitln を使用して十分な長さの文字列 (2 語以上) を待機し、if...then...endif を使用します。
于 2015-01-28T17:48:44.183 に答える
0
マクロのタイムアウト期間を確認してください。タイムアウトの値を明示的に指定する
于 2015-12-23T04:42:46.930 に答える