gammaman64
Programmer
I think we have a misunderstanding. The text that the user types in the widget, is a file on the users HHD, I want that file that the user types in to be looked for, so that it can return to the dos window the information being searched for.
sub check {
my $check = $mw->DialogBox(
-background => 'red',
-title => 'Type the file you wish to check',
-buttons => [ 'OK', 'Cancel' ],
-default_button => 'OK',
);
my $txt;
my $entry = $check->Entry (
-textvariable => \$txt,
)->pack;
my $click = $check->Show();
return unless $click eq 'OK';
foreach my $try (@ARGV){
print ("Checking $txt\n");
if (-f $txt)
{
print ("The file $txt is:");
print ("readable") if (-r $txt);
print ("writable") if (-w $txt);
print ("executable") if (-x $txt);
}
elsif (-d $txt)
{
print ("$txt is a directory");
my @time = timeconv(-A $txt);
print "The file was last accessed at $time[0] days, ",
"$time[1] hours, $time[2] minutes ",
"and $time[3] seconds.\n";
}
}
}
sub timeconv{
my $time = shift();
my $days = int ($time);
$time = ($time - $days) * 24;
my $hours = int ($time);
$time = ($time - $hours) * 60;
my $minutes = int ($time);
$time = ($time - $minutes) * 60;
my $seconds = int ($time);
return ($days, $hours, $minutes, $seconds);
}
sub check {
my $check = $mw->DialogBox(
-background => 'red',
-title => 'Type the file you wish to check',
-buttons => [ 'OK', 'Cancel' ],
-default_button => 'OK',
);
my $txt;
my $entry = $check->Entry (
-textvariable => \$txt,
)->pack;
my $click = $check->Show();
return unless $click eq 'OK';
foreach my $try (@ARGV){
print ("Checking $txt\n");
if (-f $txt)
{
print ("The file $txt is:");
print ("readable") if (-r $txt);
print ("writable") if (-w $txt);
print ("executable") if (-x $txt);
}
elsif (-d $txt)
{
print ("$txt is a directory");
my @time = timeconv(-A $txt);
print "The file was last accessed at $time[0] days, ",
"$time[1] hours, $time[2] minutes ",
"and $time[3] seconds.\n";
}
}
}
sub timeconv{
my $time = shift();
my $days = int ($time);
$time = ($time - $days) * 24;
my $hours = int ($time);
$time = ($time - $hours) * 60;
my $minutes = int ($time);
$time = ($time - $minutes) * 60;
my $seconds = int ($time);
return ($days, $hours, $minutes, $seconds);
}