Posted to tcl by Saedelaere at Fri Nov 16 13:05:49 GMT 2007view raw

  1. #! /bin/sh
  2. # the next line restarts using wish \
  3. exec wish "$0" "$@"
  4.  
  5. set home_path $::env(HOME)
  6.  
  7. set file $::home_path/.tv-viewer/config/channels.conf
  8. set f [open $file r]
  9. set i 1
  10. while {[gets $f line]!=-1} {
  11. foreach {kanal channel} [split $line] {
  12. set kanalid($i) $kanal
  13. }
  14. incr i
  15. }
  16. parray kanalid
  17. if { "$kanalid($i)" == "ARD" } {
  18. puts aha
  19. }
  20.  
  21. exit 0

Comments

Posted by Saedelaere at Fri Nov 16 21:28:30 GMT 2007 [text] [code]

#! /bin/sh # the next line restarts using wish \ exec wish "$0" "$@" set home_path $::env(HOME) proc channel_up {} { set file $::home_path/.tv-viewer/config/channels.conf set f [open $file r] set i 1 while {[gets $f line]!=-1} { if { "$::kanalid($i)" == "ZDF" } { puts $i set rechnung [expr {($i == 30) ? 1 : ($i + 1)}] puts $rechnung puts $::kanalid($rechnung) } incr i } } proc channel_down {} { set file $::home_path/.tv-viewer/config/channels.conf set f [open $file r] set i 1 while {[gets $f line]!=-1} { if { "$::kanalid($i)" == "ARD" } { set rechnung [expr {($i == 1) ? 30 : ($i - 1)}] puts $rechnung puts $::kanalid($rechnung) } incr i } } set file $::home_path/.tv-viewer/config/channels.conf set f [open $file r] set i 1 while {[gets $f line]!=-1} { foreach {kanal channel} [split $line] { set kanalid($i) $kanal } incr i } channel_down this the working code for channel_up and channel_down. I'am sure this could be done much better but it works for me :)