I am having a problem, with the progress bar not displaying in a window.
Here is my subroutine. Feel free to offer any comments you want about
cleaning up this code:
sub Modify_Policy
{
open (FILE,'>policies.log');
our $loop = @modarray;
our $w5 = 450;
our $h5 = 125;
our $iterate = 0;
our $progress = Win32::GUI::Window->new
(
-name => 'Progress',
-width => $w5,
-height => $h5,
-text => 'Conversion Progress',
);
$progress->AddProgressBar
(
-name => 'PB',
-height => 20,
-width => 400,
-left => 20,
-top => 20,
);
$progress->PB->SetRange(0,$loop);
$desk = Win32::GUI::GetDesktopWindow();
$dw = Win32::GUI::Width($desk);
$dh = Win32::GUI::Height($desk);
$x = ($dw - $w5) / 2;
$y = ($dh - $h5) / 2;
$progress->Move($x, $y);
our $sb=$progress->AddStatusBar();
$progress->Show();
foreach my $item (@modarray)
{
$item =~ s/\s*$//;
our $item1 = $item;
$item1 =~ s/$policy/$policy\:Windows XP\:Windows Group Policy/;
print FILE "Modifying: $item1\n";
our $oldpath = `getname /a=zenwmGroupPolicyPath \."$item1\" /mq
/yc /v /j`;
print FILE "Old Policy Path: $oldpath";
our @pathsplit = split (/\\/, $oldpath);
our $result = `setname /a=zenwmGroupPolicyPath \"\.$item1\"
\"\\\\$pathsplit[2]\\$path1\"`;
print FILE "$result\n";
$progress->PB->SetPos($iterate);
$sb->Text("Converting $item");
}
$progress->Hide();
close FILE;
my $popup = Win32::MsgBox("Policy Path Modification Complete!");
return -1;
}
--
Andy Pastuszak
Desktop Engineer II
Commerce Bank
[EMAIL PROTECTED]
(856)470-3270
____________________________
This message and any attachments may contain confidential or privileged
information and are intended only for the use of the intended recipients of
this message. If you are not the intended recipient of this message, please
notify the sender by return email, and delete this and all copies of this
message and any attachments from your system. Any unauthorized disclosure,
use, distribution, or reproduction of this message or any attachments is
prohibited and may be unlawful.
____________________________