home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.muug.mb.ca
/
2014.06.ftp.muug.mb.ca.tar
/
ftp.muug.mb.ca
/
pub
/
src
/
tcl
/
examples
/
browse
next >
Wrap
Text File
|
1994-11-01
|
719b
|
39 lines
#!/usr/local/bin/wish -f
#
# browse through specified or current directory
#
listbox .list -yscroll ".scroll set" -relief raised -geometry 20x20
pack .list -side left
scrollbar .scroll -command ".list yview"
pack .scroll -side right -fill y
if {$argc > 0} {
set dir [lindex $argv 0]
} else {
set dir "."
}
foreach i [exec ls -a $dir] {
.list insert end $i
}
bind .list <Double-Button-1> {
browse $dir [selection get]
}
bind .list <Control-c> {destroy .}
focus .list
proc browse {dir file} {
global env
if {$dir != "."} {set file $dir/$file}
if [file isdirectory $file] {
exec browse $file &
} else {
if [file isfile $file] {
exec xedit $file &
} else {
puts stderr "can't browse $file"
}
}
}