OK, so I read the responses and felt pretty good about taking the plunge and learning some Tk. I had a little trouble getting the right modules installed, but after that was sorted out I was able to get up to speed pretty quickly.
I am a little surprised at how easy it was to write a useful program, even without a fancy GUI-IDE.
Anyway, here is my first (usefull) PERL/Tk program. I'll actually be using it at work for some server upgrades tomorrow.
Thanks for the input!
----------START_PERL/Tk_Code----------
use Tk;
use Net::Ping;
use strict;
use Net::Ping;
use strict;
my $oPing = Net::Ping->new('icmp',2);
my @button_list = ();
my @server_list = qw(
servername1
servername2
servername3
servername4
servername5
servername6
servername7
);
my @server_list = qw(
servername1
servername2
servername3
servername4
servername5
servername6
servername7
);
my $mw = MainWindow->new;
$mw->repeat(5000,\&pinglist);
foreach my $server (@server_list) {
push(@button_list ,
$mw->Button(-text => $server,
-command => [\&ts , $server],
-background ="" 'grey',
-foreground => 'black',
-activebackground => 'yellow',
-activeforeground => 'black',
)
);
}
fo! r( my $i = 0; $i < scalar(@button_list); $i++ ) {
$button_list[$i]->pack;
}
push(@button_list ,
$mw->Button(-text => $server,
-command => [\&ts , $server],
-background ="" 'grey',
-foreground => 'black',
-activebackground => 'yellow',
-activeforeground => 'black',
)
);
}
fo! r( my $i = 0; $i < scalar(@button_list); $i++ ) {
$button_list[$i]->pack;
}
MainLoop;
##
###############################
##
sub ts
{
my $server = shift;
my $cmd = "start C:\\WINNT\\SYSTEM32\\mstsc.exe /h:768 /w:1024 /v:$server";
`$cmd`;
}
{
my $server = shift;
my $cmd = "start C:\\WINNT\\SYSTEM32\\mstsc.exe /h:768 /w:1024 /v:$server";
`$cmd`;
}
sub pinglist
{
for( my $i = 0; $i < scalar(@button_list); $i++ ) {
if( $oPing->ping($button_list[$i]->cget('text')) ) {
$button_list[$i]->configure(-background=""> } else {
$button_list[$i]->configure(-background="" ,-foreground=>'white');
}
$button_list[$i]->pack;
}
}
{
for( my $i = 0; $i < scalar(@button_list); $i++ ) {
if( $oPing->ping($button_list[$i]->cget('text')) ) {
$button_list[$i]->configure(-background=""> } else {
$button_list[$i]->configure(-background="" ,-foreground=>'white');
}
$button_list[$i]->pack;
}
}
----------END___PERL/Tk_Code----------
Stephen A. Jarjoura
Runester.com
Runester.com
_______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm

