{Darkavich} Steven Misrack wrote:
Could you share your scripts?
The second is for my new SRSS3 on linux rollout and is written in
Perl/Tk. It adds another feature w/ utquery. This is my first attempt a
tk script, had fun, but I'm sure that there are better ways of doing it.
Bob
---------------------------------------
#!/usr/bin/perl -w
#
# SunRayInfo pathname
use Tk;
#use strict;
# get the address of the SunRay we are now on.
open(P, "xprop -root|") || warn "can't open: $!";
while (<P>) { # do something with input
$addr=(split('=',(split(' '))[3]))[1] if(/^_SUN_SUNRAY_CONN_INFO/ ) ; }
close(P) || warn "can't close: $!";
my $mw = MainWindow->new;
$mw->title("SunRay Information");
my $f = $mw->Frame();
$f->pack(-side=>'left',-fill=>'y');
my $l = $f->Listbox(-width => 10, -selectmode => 'single');
$l->pack(-side => 'top',-fill=>'both'); $l->insert('end', qw/Basic
Session XConfig Multihead Query/); my $exb =
$f->Button(-text=>"Exit",-command=> sub { exit });
$exb->pack(-side=>'bottom',-anchor=>'s');
# Try changing the Text area to a Lable so that it cannot be edited.
$t = $mw->Scrolled("Text",-scrollbars => "se", -width => 40, -height
=>13, -wrap => 'none'); $t->pack(-fill=>'both',-expand=>1);
fill_basic(0);
$l->bind('<Button-1>',[\&list_event, $t]); MainLoop;
sub list_event {
my($widget) = @_;
$t->delete("1.0",'end');
$sel=($l->curselection())[0];
#$t->insert('end', "Selected : $sel\n");
fill_basic($sel);
}
sub fill_basic {
my ($sel) = @_;
if($sel==0) { # Basic Information
$t->insert('end', " Login Name: $ENV{LOGNAME}\n");
$t->insert('end', "Session Mgr: $ENV{SESSION_MANAGER}\n");
$t->insert('end', " Display: $ENV{DISPLAY}\n");
$t->insert('end', " Token: $ENV{SUN_SUNRAY_TOKEN}\n");
$t->insert('end', " IP Address: $addr\n");
$t->insert('end', " Host: $ENV{HOSTNAME}\n");
} elsif ($sel==1) { # Session Info
open(P, "sudo /opt/SUNWut/sbin/utsession -p |") || warn "can't
open: $!";
while (<P>) { # do something with input
$t->insert('end', $_);
}
close(P) || warn "can't close: $!";
} elsif ($sel==2) { # X Config Info
open(P, "/opt/SUNWut/bin/utxconfig -l |") || warn "can't open: $!";
while (<P>) { # do something with input
$t->insert('end', $_);
}
close(P) || warn "can't close: $!";
} elsif ($sel==3) { # Multihead info
open(P, "/opt/SUNWut/sbin/utmhadm |") || warn "can't open: $!";
while (<P>) { # do something with input
$t->insert('end', $_);
}
close(P) || warn "can't close: $!";
} elsif ($sel==4) { # utquery
open(P, "/opt/SUNWut/sbin/utquery -d $addr |") || warn "can't
open: $!";
while (<P>) { # do something with input
$t->insert('end', $_);
}
close(P) || warn "can't close: $!";
} else {
open(P, "xprop -root | grep NET |") || warn "can't open: $!";
while (<P>) { # do something with input
$t->insert('end', $_);
}
close(P) || warn "can't close: $!";
$t->insert('end', "How'd ya get here?!?\n");
}
$t->yview('0');
} # end fill_basic
_______________________________________________
SunRay-Users mailing list
[email protected]
http://www.filibeto.org/mailman/listinfo/sunray-users