Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How can I redirect Windows command line output into a PerlTk frame

by frieduck (Hermit)
on Mar 05, 2009 at 01:28 UTC ( #748372=note: print w/ replies, xml ) Need Help??


in reply to How can I redirect Windows command line output into a PerlTk frame

dir 2>&1 doesn't work in Windows. cmd.exe /c dir does.
Following is my updated version. I also had to change -text => $cmdLineText to -textvariable => \$cmdLineText for the Label to see the changes in the variable.

use warnings; use strict; use Tk; use Tk::Button; use Tk::Checkbutton; use Tk::LabEntry; use Tk::Label; my $cmdLineText; my $mw=MainWindow->new(-title=>'Foo Installer'); my $row = 0; my $w_install = $mw-> Button ( -overrelief=>'raised', -relief=>'raised +', -text=>'Install', -command=>\&installItems) -> grid(-column=>0, -r +ow=>++$row, -columnspan=>3, -sticky=>'nsew'); my $w_cmdWindow = $mw->Label (-height=>7, -foreground=>'white', -backg +round=>'black', -textvariable => \$cmdLineText)->grid(-column=>0, -ro +w=>++$row, -columnspan=>3, -rowspan=>10, -sticky=>'nsew'); MainLoop; sub installItems { open (FILE, "cmd.exe /c dir|"); #does something $cmdLineText = ""; while (<FILE>) { #chomp; $cmdLineText .= $_; } close(FILE); }


Comment on Re: How can I redirect Windows command line output into a PerlTk frame
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://748372]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-04-20 20:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (487 votes), past polls