は一時的な期待のスクリプトを記述した新しいxtermの上
をButton2のために関連する表彰
メインのファイルからファイルにコピーし、その一時的なスクリプトをあなたのxtermで実行します。例えば、
#! /usr/bin/env expect
package require Tk 8.5
package require fileutil ;# You need to have Tcllib installed for this.
proc action1 {} {
set temp [::fileutil::tempfile]
::fileutil::writeFile $temp {
# Delete the temporary file as soon as it has been read.
file delete $argv0
# Your Expect script for Action 1 follows here.
puts {Hello from a new Expect process!}
sleep 3
}
exec xterm -e expect -f $temp &
}
# Display the GUI.
grid \
[::ttk::button .action1 -text {Action 1} -command action1] \
[::ttk::button .quit -text Quit -command {exit 0}]
vwait forever
代わりに、各コマンドの定義済みの、非一時的な期待スクリプトファイルを持つことができます。あなたは期待やtclsh
から
exec xterm -e expect -f action1.exp &
と同様にそれを実行することができます。
出典
2016-05-20 18:01:49
nwk
はない一つでもxtermのように「シンプル」として、GUIアプリケーションを自動化しません期待しています。 –