|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#!/usr/bin/expectk
# Edrx, 2004sep09
# (find-man "3tk Tk_ConfigureInfo")
# (find-man "3tk canvas")
# (find-man "3tk options")
# (eetcl "source $env(HOME)/EXPECT/player")
# (eev "expectk ~/EXPECT/player")
# (find-status "tk8.4")
# (find-vldifile "tk8.4.list")
# (find-udfile "tk8.4/")
# (find-udfile "tk8.4/examples/")
set playerpid ""
proc playwith {prog file} {
global playerpid
set playerpid [spawn $prog $file]
}
proc play {file} {
if [regexp "\\.wav$" $file] {
playwith bplay $file
} elseif [regexp "\\.ogg$" $file] {
playwith ogg123 $file
} elseif [regexp "\\.mp3$" $file] {
playwith mpg123 $file
} else {
error "I don't know how to play this file: $file"
}
}
proc killplayer {} {
global playerpid
if {$playerpid!=""} then {exec kill $playerpid}
}
proc playnow {file} { killplayer; play $file }
pack [canvas .c -background sienna4] -expand yes -fill both
# .c config -cursor {arrow red yellow}
.c config -cursor {dot sienna3}
# (find-tclbook2page (- 167 126))
# (find-tkexfile "widget")
# (find-fline "/usr/X11R6/lib/X11/icons/handhelds/cursors/dot")
# (find-es "x" "Xnest")
set nextx 20
set nexty 20
set nexttag medicine_1
set grouptag level1
#
proc mytext {text} {
global nextx nexty nexttag grouptag
.c create text $nextx $nexty -anchor sw -text $text \
-tag "$nexttag $grouptag"
incr nexty 15
regexp {^(.*[^0-9])([0-9]+)$} $nexttag all part1 part2
set nexttag $part1[expr {$part2+1}]
}
proc hilit {tag} { .c itemconfigure $tag -fill orange }
proc unhilit {tag} { .c itemconfigure $tag -fill black }
proc allgoodthings {} {
play "/hda7/tmp/wavs/Medicine (1) - All Good Things.wav"
}
proc heads {} { playnow "/hda7/tmp/wavs/Medicine (10) - Heads.wav" }
proc aarhus {} { playnow "/hda7/tmp/wavs/Medicine (8) - Aarhus.wav" }
bind . a allgoodthings
bind . A aarhus
bind . h heads
bind . c close
bind . p {puts $playerpid}
bind . k killplayer
bind . q exit
bind . 1 { unhilit level1; hilit medicine_1 }
bind . 2 { unhilit level1; hilit medicine_2 }
bind . 3 { unhilit level1; hilit medicine_3 }
mytext "a: All Good Things"
mytext "A: Aarhus"
mytext "h: Heads"
interpreter