[27012] in Perl-Users-Digest
Perl-Users Digest, Issue: 8941 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 10 18:05:40 2006
Date: Fri, 10 Feb 2006 15:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 10 Feb 2006 Volume: 10 Number: 8941
Today's topics:
Re: Program to generate buttons for sequence of command (Raghuramaiah Gompa)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 10 Feb 2006 19:22:34 +0000 (UTC)
From: rgompa@steel.ucs.indiana.edu (Raghuramaiah Gompa)
Subject: Re: Program to generate buttons for sequence of commands
Message-Id: <dsip5q$24i$1@rainier.uits.indiana.edu>
Thank you so much for the code. This code generated the
button I wanted, however, the commands are not executed.
I am using Win Xp and the commands are for unix system.
What is it that I need to do to execute commands (such
as c:\texmf\miktex\bin\latex.exe test ) in
windows? .. Raghu rgompa@iuk.edu
In article <k8bpu1p3ll108b91n4vlkliqphmgjou1rv@4ax.com>,
zentara <zentara@highstream.net> wrote:
>On Thu, 9 Feb 2006 14:57:49 +0000 (UTC),
>rgompa@steel.ucs.indiana.edu
>(Raghuramaiah Gompa) wrote:
>
>>
>>I am new to perl. I am trying to write a code, runme.pl,
>>to
>>generate 16 buttons in 4 rows and 4 colums. Each button
>>will be associated with a sequence of commands. For
>>examle, after perl runme.pl test, when pressed the first
>>button, it should execute:
>>
>>latex test.tex
>>dvips test.dvi
>>gview test.ps
>>
>>(This is similar to TeXorg, if you know this. But
>>this will have a sequence of commands for each button
>>- not just one command.) Will you please help me get
>>started? Is this possible?
>
>Here is a basic demo, making it look even is up to you.
>
>#!/usr/bin/perl
>use warnings;
>use strict;
>use Tk;
>
>my $mw = tkinit;
>#$mw->geometry("400x400");
>my $rF = $mw->Frame( -width => 400 )->grid;
>
>my %buttons;
>
>my %commands = (
> '1-1' => {text => 'Date', com =>'date', color=> 'pink'},
> '1-2' => {text => 'ls', com => 'ls -la', color
>=> 'lightblue'},
> '1-3' => {text => 'Date', com =>'date', color=> 'pink'},
> '1-4' => {text => 'top', com => 'ls -la', color
>=> 'lightblue'},
> '2-1' => {text => 'ps', com =>'date', color=> 'pink'},
> '2-2' => {text => 'ls', com => 'ls -la', color
>=> 'lightblue'},
> '2-3' => {text => 'Dateyada', com =>'date',
>color=> 'pink'},
> '2-4' => {text => 'lsfoobar', com => 'ls -la', color =>
>'lightblue'},
> '3-1' => {text => 'Datexxxx', com =>'date',
>color=> 'pink'},
> '3-2' => {text => 'lsccc', com => 'ls -la', color =>
>'lightblue'},
> '3-3' => {text => 'Datebbbb', com =>'date',
>color=> 'pink'},
> '3-4' => {text => 'lsnnn', com => 'ls -la', color =>
>'lightblue'},
> '4-1' => {text => 'Date777', com =>'date',
>color=> 'pink'},
> '4-2' => {text => 'ls777', com => 'ls -la', color =>
>'lightblue'},
> '4-3' => {text => 'Dategggcom', com =>'date',
>color=> 'pink'},
> '4-4' => {text => 'lsgggcom', com => 'ls -la', color =>
>'lightblue'},
>);
>
>
>foreach my $key(keys %commands){
> my ($i, $j) = split /-/,$key;
> $buttons{$key}{'button'} = $rF->Button(
> -text => $commands{$key}{'text'},
> -background => $commands{$key}{'color'},
> -command => sub{ &launch( $key ) }
> )->grid(-row=>$i, -column=> $j );
>}
>
>MainLoop;
>
>sub launch {
> my $key = shift;
> my $command = $commands{$key}{'com'};
> if(fork==0){ exec "xterm -hold -e $command" }
>
>}
>__END__
>
>
>--
>I'm not really a human, but I play one on earth.
>http://zentara.net/japh.html
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8941
***************************************