Yes, I will be executing batch files from within Perl, however these batch files or bundles are all silent software installation programs. Some of these batch file (we call them 'GO' scripts here) require some sort of user intervention, but some do not. I want to differentiate between the one that do require manual intervention to the ones that do not.
For example :
I might have a batch bundle that is called office2003.go. Inside this batch bundle I will have things like msword.go, excel.go, project.go....etc. when I click on this batch file, a progress bar appears on the screen and a message informing the tasks the go scripts is doing (in this case installing the whole office software suit).
On the other hand, I might have another batch bundle, which is called something like Autoscore.go that installs the Autoscore software. However at some point during the installion, another dialog window might appear requesting further information or it will simple fail.
This is basically what I am trying to achieve, is to distinguish between Go scripts that installs fully without user intervention and other go scripts that either fail out right or will never install untill maual intervension is provided.
If I do this manually it would probably take me months to finish of because I have thousands of these applications or batch bundles
I suppose a good place for me to start would be if I can write a script that runs a batch file and informs whether the batch execution has completed successfully or not.
Mind you some batch file could take few seconds to install and other batch bundles could take hours. so I suppose I have tp rogram some sort of timing threshold knowing that the longest batch bundle would not take more that 6 hours to install.
Thanks
| [reply] |
If you're starting the .go files from within your Perl script, you should be able to start them up with system, and when that function returns the program is complete.
| [reply] [d/l] |
#! c:\perl\bin
$|++;
use strict;
use vars qw /%data/;
$data{apps_list} = shift @ARGV;
system (cls);
print "\n\nPath to apps list => ". $data{apps_list}."\n";
open (LST, "$data{apps_list}") || die "$! : File was not found\n";
chomp (@{$data{Go_scripts}} = <LST>);
for my $item (@{$data{Go_scripts}})
{
print "\n$item\n";
system ($item);
if (system() ==0) # this is incorrect
{
print "\n Done\n";
}
else
{
print "Failed\n";
}
}
Obviously it doesn't work because of the "if (system() ==0)" which is not correct, but the correct way of this is what I am trying to achieve!
Any Thoughts?
TIA
| [reply] [d/l] |