#! /usr/bin/perl use Tk; sub Run { $i = $list->curselection(); $data= $list->get( $i ); $chart = substr $data, 0, 3; $file = `ls -tr $dpath/$chart/*.png | tail -1`; chop $file; print "$data - $chart - $file\n"; $text->delete( "1.0", "end" ); $text->insert( 'end', "$data - $chart - $file" ); `xv $file &`; } ############################ # Main Program ############################ $os = "Win" if $^O eq "MSWin32"; if( $os eq "Win" ){ if( -e "c:/wxp/bin" ){ $binpath = "c:\\WXP\\bin\\"; $default="c:/wxp/etc"; } if( -e "d:/wxp/bin" ){ $binpath = "d:\\WXP\\bin\\"; $default="d:/wxp/etc"; } if( -e "e:/wxp/bin" ){ $binpath = "e:\\WXP\\bin\\"; $default="e:/wxp/etc"; } } else { $binpath="/home/wxp/bin/"; $default="/home/wxp/etc"; $dpath = "/home/wxp/difax"; $dpath = "/noaaport/unisys/difax"; } $mw = MainWindow->new; $mw->title( "ptkDifax" ); $mw->geometry( "+10+10" ); $bar = $mw->Frame->pack( -side => "top", -fill => "x" ); $bquit = $bar->Button( -text => "Quit", -command => sub { exit } ) ->pack( -side => "right" ); $frm = $mw->Frame->pack( -side => "top", -fill => "x" ); $list = $frm->Scrolled( "Listbox", -scrollbars => "e", -width => 60, -height => 8 ) ->pack( -side => "top", -fill => "x" ); $list->packAdjust(); $list->bind( '', \&Run ); $text = $frm->Scrolled( "Text", -scrollbars => "se", -width => 60, -height => 10 ) ->pack( -side => "top", -fill => "both", -expand => 1 ); open FILE, "/home/wxp/ptk/difax.cfg"; while( ){ chop; push @items, $_; } $list->insert( 'end', @items ); MainLoop;