473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Active State Perl 5.8.x, OLE, and Excel not creating files

8
how do i get this to actually fill in and save? when i run my script now it has 2 books with blank sheets.

my wrapper file (batch), with computer names removed for safety/brevity:
Expand|Select|Wrap|Line Numbers
  1. @echo on
  2. rem this batch is for cataloguing computers using two other "helpers"
  3. rem "helpers" are psinfo and compinfo
  4. rem information section is over, turning echo off.
  5. @echo off
  6.  
  7. compinfo -l l1.txt -c [a bunch of computer names] >> errlog.txt 
  8. compinfo -l l2.txt -c [a bunch of computer names] >> errlog.txt
  9.  
it gives these errors:

errors:
Expand|Select|Wrap|Line Numbers
  1. E:\lab reports\test19>rem information section is over, turning echo off.
  2. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  3. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  4. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  5. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  6. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  7. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  8. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  9. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  10. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  11. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  12. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  13. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  14. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  15. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  16. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  17. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  18. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  19. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  20. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  21. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  22. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  23. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  24. Not a subroutine reference at compinfo.pl line 329.
  25. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  26. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  27. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  28. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  29. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  30. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  31. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  32. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  33. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  34. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  35. Can't spawn "cmd.exe": Bad file descriptor at compinfo.pl line 159.
  36. Not a subroutine reference at compinfo.pl line 329.
  37.  
  38. E:\lab reports\test19>
Mar 9 '06 #1
3 4383
m3rajk
8
and the code for the script/program is
Expand|Select|Wrap|Line Numbers
  1. #! /usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Getopt::Long; # used in getting unix-style options
  5. use Win32::OLE;
  6. use Win32::OLE::Const 'Microsoft Excel'; # use OLE/Excel
  7. $Win32::OLE::Warn = 3; # die on errors...
  8.  
  9. ################################################################################
  10. # Purpose:
  11. #    This script catalogues the psinfo information on systems, including patches
  12. # and software. This is sent to an excel spread sheet for easy comparison. This
  13. # is done to keep on top of what software/patches do not have negative impacts
  14. # upon SeaChange(tm) systems
  15. #
  16. # This should be kept as both a script and an executable. The executable should
  17. # be made by the last person to revise the script. The Active State Perl PDK has
  18. # been used.
  19. #
  20. # Created: 03/02/2006
  21. # Original Author: Josh Perlmutter
  22. # Maintainers:
  23. # Last Revised: 03/07/2006
  24. # Copyright SeaChange International (tm)
  25. ################################################################################
  26.  
  27. my(@comps);
  28. my($comp, $date);
  29. # standard options/revision information variables
  30. # verbose line is 79 chars long w/2 \t
  31. # base to use to add options:        -<option>\t\t<use>
  32. my($help, $usage, $verb, $qrev, $rev, $revdat, $modules, $log, $err);
  33. $modules="\tnone as of now\n\n"; $help=0; $qrev=0; $err=0;
  34. $rev="0.0.3"; $revdat="03/08/2006"; $verb=0; $log='';
  35. $usage = <<EOD;
  36. \tFile: $0\tVersion: $rev\tReleased: $revdat\n
  37. This is the $0 file.\n
  38. The options for this file are:
  39.         -help           This help screen only (overrides all other options)
  40.         -log            File to log to (appends if the file exists)
  41.         -version        List Version and exit (overrides everything but -help)
  42.         -verbose        Turn on verbose (useful for debugging errors; call twice
  43.                          for extra output)
  44.  
  45.         usage ([] denotes optional argument {} denotes default value
  46.                {} denotes option set of which your choice of one is required):
  47. $0 [-help] [-version] [-verbose]
  48. to debug try: $0 -verb -verb > debug_log.txt\n
  49. EOD
  50.  
  51. # short explanation of variables:
  52.  
  53.  
  54. ######
  55. # this section deals with options. it looks for unix-style options passed. that
  56. # is, <script> -option [value]
  57. # now get the options 
  58. GetOptions ('help'=>\$help, 'verbose+'=>\$verb, 'version'=>\$qrev,
  59.         'log:s'=>\$log, 'computers:s' => \$comp);
  60.  
  61.  
  62. ###########################
  63. # arguments ARE required
  64. unless($help || $qrev ||
  65.        ($log)){
  66.   my $necessary = <<EOD;
  67.         You must supply at least 1 parameter(s) to run this program. It needs:
  68. -log     log file to log actions to (appends if existing)
  69. Turning on help
  70. EOD
  71.   print $necessary;
  72.   $help++;
  73. }
  74.  
  75. #
  76. # now put the options to use...
  77. #
  78.  
  79. # show usage and exit if asked for
  80. die $usage if $help;
  81.  
  82. # report version and exit
  83. die "\tFile: $0\tVersion: $rev\tReleased: $revdat\n" if $qrev;
  84.  
  85. ####################################################
  86. ## this is a standardized reporting subroutine #####
  87. ## it takes a line and a flag for verbose and  #####
  88. ## reports to a universal file handle (and screen) #
  89. ####################################################
  90. sub rep{
  91.   # this assumes two passed values,
  92.   # first a message
  93.   # second a flag for verbose (screen printing)
  94.   my $time=localtime().' | ';
  95.   print LOG "$time $_[0]\n";
  96.   if($_[1]){ print STDOUT "$time $_[0]\n"; }
  97. }
  98.  
  99. sub getinfo(){
  100.   #############################################################################
  101.   ## this grabs the system information for reporting at the begining of logs ##
  102.   #############################################################################
  103.  
  104.   my $nname=`hostname`; chomp($nname);
  105.   my $nos=`ver`; $nos =~ s/\W*(\w.*\])\s.*/$1/;
  106.   my $nip=`ipconfig`; $nip =~ s/\D+([\d\.]{7,15})[\D\d]*/$1/;
  107.  
  108.   my $info= <<EOD;
  109. Program Information:
  110. Script: $0
  111. Last Updated: $revdat          Version $rev
  112.  
  113. System Information:
  114.        Node Name: $nname
  115.        Node OS: $nos
  116.        Node IP: $nip
  117.  
  118. EOD
  119.   return $info;
  120. }
  121.  
  122. sub dbg{
  123.   # this is a debugging subroutine that prints things to screen if the
  124.   # verbosity level is high enough
  125.   my $item=$_[1];
  126.   my $dbgpt=$_[0];
  127.  
  128.   while(1){
  129.     print "Debug Point: $dbgpt\nItem value:\n$item
  130. \n\t\tShall I continue? (y or n)\n\n";
  131.     if(<STDIN> =~ m/^n$/i){ die "\t\t\tyou chose to leave at $dbgpt\n\n"; }
  132.     elsif(<STDIN> =~ m/^y$/i){ print "Continuing to next point\n\n"; last; }
  133.     else{ print "response not understood\n"; }
  134.   }
  135. }
  136.  
  137. # start the log
  138. open LOG, ">>$log" or die "cannot open log file";
  139. &rep(&getinfo,$verb);
  140. ############################ Below is non-templeted ############################
  141. # make the computer list an array
  142. @comps=split ',', $comp;
  143.  
  144. # get the date
  145. my @rdate=split ' ', localtime();
  146. $date=$rdate[4].'-'.$rdate[1].'-'.$rdate[2];
  147. if($verb>1){ &rep("$date\n",$verb); }
  148.  
  149. foreach $comp (@comps){
  150.   # for each computer in the array
  151.   # get the following information placed into a file
  152.   # titled by the computer name and date
  153.   # or tell use why there is an error and exit
  154.  
  155.   my $err=0; # error indicator
  156.  
  157.   # this should be 0 on error and 1 on success
  158.   my $cmd="psinfo -h -s \\\\$comp > $comp-$date.txt";
  159.   my $res=system "$cmd";
  160.  
  161.   if($res){
  162.     my $err_rep="\t\tinformation gathering error!";
  163.     $err_rep.=" $res Information may not be complete.
  164. \t\tcommand: $cmd\n$!\n$^E\n\n";
  165.     &rep($err_rep,$verb);
  166.   }else{
  167.     &rep("Cataloged $comp to $comp-$date.txt\n",$verb);
  168.   }
  169.  
  170. }
  171.  
  172. #######
  173. ## OLE interaction upon the saved files follows
  174. #######
  175.  
  176. # get an active Excel or create a new one
  177. my $Excel = Win32::OLE -> GetActiveObject('Excel.Application')
  178.   || Win32::OLE -> new('Excel.Application', 'Quit');
  179.  
  180. my $labrep=`cd`;
  181. chomp($labrep);
  182. if (substr($labrep, -1) ne '\\'){ $labrep.='/'; }
  183. $labrep.="Lab_Report_$date.xls";
  184.  
continued...
Mar 9 '06 #2
m3rajk
8
Expand|Select|Wrap|Line Numbers
  1. # does the file exit?
  2. if(-e "$labrep"){
  3.   #we are just adding to it, so open it
  4.   my $report = $Excel->Workbooks->Open("$labrep");
  5.   my $ws = $report -> Worksheets(1);
  6.  
  7.   my $ldate = localtime();
  8.   &rep("Examining information gathered from lab computers @ $ldate\n", $verb);
  9.  
  10.   # start row counter
  11.   my $row=2;
  12.   # set row counter to continue at the end of what's there
  13.   my $ncell = $ws -> Range("A$row") -> {'Value'};
  14.   while($ncell =~ m/\w+/i){
  15.     $row++; # increment row & V- grab next row's data -V
  16.     $ncell = $ws -> Range("A$row") -> {'Value'};
  17.   }
  18.  
  19.   foreach my $node (@comps){
  20.     # for each node we check the information returned
  21.     # if there is no information we only have two items to place on the row,
  22.     # otherwise we have A-V items
  23.  
  24.     # set the first cell since that's always going to be the same
  25.     $ws -> Cells($row, "A") -> ('Value') = "$node";
  26.  
  27.     # try to open the file with the information
  28.     open LNINFO, "<$comp-$date.txt" or $err=1;
  29.  
  30.     if($err){
  31.       # there was an error on the file, so note that in the report
  32.       $ws -> Cells($row, "B") -> ('Value') =
  33.     "$comp-$date.txt could not be opened to be put into the lab report. $! $^E\n";
  34.  
  35.     }else{
  36.       # there was no error, so now we check the file,
  37.       # first reading in the file
  38.       my @examine;
  39.       while(<LNINFO>){
  40.     push @examine, $_;
  41.       }
  42.  
  43.       # then noting which couldnt be connected to
  44.       if($examine[6] =~ m/The network path was not found./i ){
  45.     $ws -> Cells($row, "B") -> ('Value') = "The network path was not found.";
  46.  
  47.       }else{
  48.     # we need to run through the file for the information to put into the rows
  49.  
  50.     # drop what's before what we need
  51.     while (!($examine[0] =~ m/Uptime.*/i)){ shift(@examine); }
  52.  
  53.     while (!($examine[0] =~ m/OS Hot Fix.*/i)){
  54.       # now go through a series of if/elsif sections for the rest
  55.       # hot fixes and programs will be handled slightly differently though
  56.  
  57.       if($examine[0] =~ m/Uptime:\s+(\w.*)/i){
  58.         $ws -> Cells($row, "E") -> ('Value') = "$1";
  59.       }elsif($examine[0] =~ m/Kernel version:\s+(\w.*)/i){
  60.         $ws -> Cells($row, "F") -> ('Value') = "$1";
  61.       }elsif($examine[0] =~ m/Product type:\s+(\w.*)/i){
  62.         $ws -> Cells($row, "G") -> ('Value') = "$1";
  63.       }elsif($examine[0] =~ m/Product version:\s+(\w.*)/i){
  64.         $ws -> Cells($row, "H") -> ('Value') = "$1";
  65.       }elsif($examine[0] =~ m/Service pack:\s+(\w.*)/i){
  66.         $ws -> Cells($row, "I") -> ('Value') = "$1";
  67.       }elsif($examine[0] =~ m/Kernel build number:\s+(\w.*)/i){
  68.         $ws -> Cells($row, "J") -> ('Value') = "$1";
  69.       }elsif($examine[0] =~ m/Registered organization:\s+(\w.*)/i){
  70.         $ws -> Cells($row, "K") -> ('Value') = "$1";
  71.       }elsif($examine[0] =~ m/Registered owner:\s+(\w.*)/i){
  72.         $ws -> Cells($row, "L") -> ('Value') = "$1";
  73.       }elsif($examine[0] =~ m/Install date:\s+(\w.*)/i){
  74.         $ws -> Cells($row, "M") -> ('Value') = "$1";
  75.       }elsif($examine[0] =~ m/Activation status:\s+(\w.*)/i){
  76.         $ws -> Cells($row, "N") -> ('Value') = "$1";
  77.       }elsif($examine[0] =~ m/IE version:\s+(\w.*)/i){
  78.         $ws -> Cells($row, "O") -> ('Value') = "$1";
  79.       }elsif($examine[0] =~ m/System root:\s+(\w.*)/i){
  80.         $ws -> Cells($row, "P") -> ('Value') = "$1";
  81.       }elsif($examine[0] =~ m/Processors:\s+(\w.*)/i){
  82.         $ws -> Cells($row, "Q") -> ('Value') = "$1";
  83.       }elsif($examine[0] =~ m/Processor speed:\s+(\w.*)/i){
  84.         $ws -> Cells($row, "R") -> ('Value') = "$1";
  85.       }elsif($examine[0] =~ m/Processor type:\s+(\w.*)/i){
  86.         $ws -> Cells($row, "S") -> ('Value') = "$1";
  87.       }elsif($examine[0] =~ m/Physical memory:\s+(\w.*)/i){
  88.         $ws -> Cells($row, "T") -> ('Value') = "$1";
  89.       }
  90.     }
  91.  
  92.     #  remove the line starting "OS Hot Fix..."
  93.     shift(@examine);
  94.     # create a variable for holding the hotfixes
  95.     my $hotfixes="\"";
  96.  
  97.     while (!($examine[0] =~ m/Applications.*/i)){
  98.       # while hot fixes need to be added. skip blank lines
  99.       if($examine[0] =~ m/\w/){
  100.         chomp($examine[0]);
  101.         $hotfixes .="$examine[0]\n";
  102.       }
  103.     }
  104.  
  105.     # add the hotfixes
  106.     $ws -> Cells($row, "U") -> ('Value') = "$hotfixes";
  107.  
  108.     #  remove the line starting "Applications..."
  109.     shift(@examine);
  110.  
  111.     my $apps='';
  112.     foreach my $app (@examine){
  113.       # the rest should all be applications to add
  114.       # so we're using a foreach to put them in
  115.       # only add lines that are not blank
  116.       # there are 3 special lines: NAV, Alarms, and SNMP
  117.       if($app =~ m/Symantec AntiVirus (\w+)/i){
  118.         $ws -> Cells($row, "B") -> ('Value') = "ver: $1";
  119.       }elsif($app =~ m/Alarm/i){
  120.         $ws -> Cells($row, "C") -> ('Value') = "Installed";
  121.       }elsif($app =~ m/SNMP Informant Agent \(([^\)]+)\) (\w.*)/i){
  122.         $ws -> Cells($row, "D") -> ('Value') = "$1 : $2";
  123.       }elsif($app =~ m/\s+(\w.*)/i){
  124.         $apps .= "$1\n";
  125.       }
  126.     }
  127.  
  128.     # add the other applications
  129.     $ws -> Cells($row, "V") -> ('Value') = "$apps";
  130.       }
  131.     }
  132.  
  133.     # end the loop increasing the row number
  134.     $row++;
  135.   }
  136. }else{
  137.  
continued...
Mar 9 '06 #3
m3rajk
8
Expand|Select|Wrap|Line Numbers
  1.   # we have to create it, including make the first row
  2.   $Excel -> {'Visible'} = 1;
  3.   $Excel -> { 'SheetsInNewWorkBook' } = 1;
  4.   my $workbook = $Excel -> Workbooks -> Add();
  5.   my $ws = $workbook -> Worksheets(1);
  6.   $ws -> { 'Name' } = "Lab Report $date";
  7.  
  8.   # set first row titles
  9.   $ws -> Cells(1, "A") -> ('Value') = "Node";
  10.   $ws -> Cells(1, "B") -> ('Value') = "NAV";
  11.   $ws -> Cells(1, "C") -> ('Value') = "Alarms";
  12.   $ws -> Cells(1, "D") -> ('Value') = "SNMP";
  13.   $ws -> Cells(1, "E") -> ('Value') = "Uptime";
  14.   $ws -> Cells(1, "F") -> ('Value') = "Kernel Version";
  15.   $ws -> Cells(1, "G") -> ('Value') = "Product Type";
  16.   $ws -> Cells(1, "H") -> ('Value') = "Product Version";
  17.   $ws -> Cells(1, "I") -> ('Value') = "Service Pack";
  18.   $ws -> Cells(1, "J") -> ('Value') = "Kernel Build Number";
  19.   $ws -> Cells(1, "K") -> ('Value') = "Registered Organization";
  20.   $ws -> Cells(1, "L") -> ('Value') = "Registered Owner";
  21.   $ws -> Cells(1, "M") -> ('Value') = "Install Date";
  22.   $ws -> Cells(1, "N") -> ('Value') = "Activation Status";
  23.   $ws -> Cells(1, "O") -> ('Value') = "IE Version";
  24.   $ws -> Cells(1, "P") -> ('Value') = "System Root";
  25.   $ws -> Cells(1, "Q") -> ('Value') = "Processors";
  26.   $ws -> Cells(1, "R") -> ('Value') = "Processor Speed";
  27.   $ws -> Cells(1, "S") -> ('Value') = "Processor Type";
  28.   $ws -> Cells(1, "T") -> ('Value') = "Physical Memory";
  29.   $ws -> Cells(1, "U") -> ('Value') = "Installed OS Hotfixes";
  30.   $ws -> Cells(1, "V") -> ('Value') = "Other Applications";
  31.  
  32.   my $ldate = localtime();
  33.   &rep("Examining information gathered from lab computers @ $ldate\n", $verb);
  34.  
  35.   # start row counter
  36.   my $row=2;
  37.  
  38.   foreach my $node (@comps){
  39.     # for each node we check the information returned
  40.     # if there is no information we only have two items to place on the row,
  41.     # otherwise we have A-V items
  42.  
  43.     # set the first cell since that's always going to be the same
  44.     $ws -> Cells($row, "A") -> ('Value') = "$node";
  45.  
  46.     # try to open the file with the information
  47.     open LNINFO, "<$comp-$date.txt" or $err=1;
  48.  
  49.     if($err){
  50.       # there was an error on the file, so note that in the report
  51.       $ws -> Cells($row, "B") -> ('Value') =
  52.     "$comp-$date.txt could not be opened to be put into the lab report. $! $^E\n";
  53.  
  54.     }else{
  55.       # there was no error, so now we check the file,
  56.       # first reading in the file
  57.       my @examine;
  58.       while(<LNINFO>){
  59.     push @examine, $_;
  60.       }
  61.  
  62.       # then noting which couldnt be connected to
  63.       if($examine[6] =~ m/The network path was not found./i ){
  64.     $ws -> Cells($row, "B") -> ('Value') = "The network path was not found.";
  65.  
  66.       }else{
  67.     # we need to run through the file for the information to put into the rows
  68.  
  69.     # drop what's before what we need
  70.     while (!($examine[0] =~ m/Uptime.*/i)){ shift(@examine); }
  71.  
  72.     while (!($examine[0] =~ m/OS Hot Fix.*/i)){
  73.       # now go through a series of if/elsif sections for the rest
  74.       # hot fixes and programs will be handled slightly differently though
  75.  
  76.       if($examine[0] =~ m/Uptime:\s+(\w.*)/i){
  77.         $ws -> Cells($row, "E") -> ('Value') = "$1";
  78.       }elsif($examine[0] =~ m/Kernel version:\s+(\w.*)/i){
  79.         $ws -> Cells($row, "F") -> ('Value') = "$1";
  80.       }elsif($examine[0] =~ m/Product type:\s+(\w.*)/i){
  81.         $ws -> Cells($row, "G") -> ('Value') = "$1";
  82.       }elsif($examine[0] =~ m/Product version:\s+(\w.*)/i){
  83.         $ws -> Cells($row, "H") -> ('Value') = "$1";
  84.       }elsif($examine[0] =~ m/Service pack:\s+(\w.*)/i){
  85.         $ws -> Cells($row, "I") -> ('Value') = "$1";
  86.       }elsif($examine[0] =~ m/Kernel build number:\s+(\w.*)/i){
  87.         $ws -> Cells($row, "J") -> ('Value') = "$1";
  88.       }elsif($examine[0] =~ m/Registered organization:\s+(\w.*)/i){
  89.         $ws -> Cells($row, "K") -> ('Value') = "$1";
  90.       }elsif($examine[0] =~ m/Registered owner:\s+(\w.*)/i){
  91.         $ws -> Cells($row, "L") -> ('Value') = "$1";
  92.       }elsif($examine[0] =~ m/Install date:\s+(\w.*)/i){
  93.         $ws -> Cells($row, "M") -> ('Value') = "$1";
  94.       }elsif($examine[0] =~ m/Activation status:\s+(\w.*)/i){
  95.         $ws -> Cells($row, "N") -> ('Value') = "$1";
  96.       }elsif($examine[0] =~ m/IE version:\s+(\w.*)/i){
  97.         $ws -> Cells($row, "O") -> ('Value') = "$1";
  98.       }elsif($examine[0] =~ m/System root:\s+(\w.*)/i){
  99.         $ws -> Cells($row, "P") -> ('Value') = "$1";
  100.       }elsif($examine[0] =~ m/Processors:\s+(\w.*)/i){
  101.         $ws -> Cells($row, "Q") -> ('Value') = "$1";
  102.       }elsif($examine[0] =~ m/Processor speed:\s+(\w.*)/i){
  103.         $ws -> Cells($row, "R") -> ('Value') = "$1";
  104.       }elsif($examine[0] =~ m/Processor type:\s+(\w.*)/i){
  105.         $ws -> Cells($row, "S") -> ('Value') = "$1";
  106.       }elsif($examine[0] =~ m/Physical memory:\s+(\w.*)/i){
  107.         $ws -> Cells($row, "T") -> ('Value') = "$1";
  108.       }
  109.     }
  110.  
  111.     #  remove the line starting "OS Hot Fix..."
  112.     shift(@examine);
  113.     # create a variable for holding the hotfixes
  114.     my $hotfixes="\"";
  115.  
  116.     while (!($examine[0] =~ m/Applications.*/i)){
  117.       # while hot fixes need to be added. skip blank lines
  118.       if($examine[0] =~ m/\w/){
  119.         chomp($examine[0]);
  120.         $hotfixes .="$examine[0]\n";
  121.       }
  122.     }
  123.  
  124.     # add the hotfixes
  125.     $ws -> Cells($row, "U") -> ('Value') = "$hotfixes";
  126.  
  127.     #  remove the line starting "Applications..."
  128.     shift(@examine);
  129.  
  130.     my $apps='';
  131.     foreach my $app (@examine){
  132.       # the rest should all be applications to add
  133.       # so we're using a foreach to put them in
  134.       # only add lines that are not blank
  135.       # there are 3 special lines: NAV, Alarms, and SNMP
  136.       if($app =~ m/Symantec AntiVirus (\w+)/i){
  137.         $ws -> Cells($row, "B") -> ('Value') = "ver: $1";
  138.       }elsif($app =~ m/Alarm/i){
  139.         $ws -> Cells($row, "C") -> ('Value') = "Installed";
  140.       }elsif($app =~ m/SNMP Informant Agent \(([^\)]+)\) (\w.*)/i){
  141.         $ws -> Cells($row, "D") -> ('Value') = "$1 : $2";
  142.       }elsif($app =~ m/\s+(\w.*)/i){
  143.         $apps .= "$1\n";
  144.       }
  145.     }
  146.  
  147.     # add the other applications
  148.     $ws -> Cells($row, "V") -> ('Value') = "$apps";
  149.       }
  150.     }
  151.  
  152.     # end the loop increasing the row number
  153.     $row++;
  154.   }
  155.  
  156.   $workbook -> SaveAs($labrep); # save active sheet
  157. }
  158.  
  159. # save and exit
  160. $Excel -> Workbooks -> Save(); # save file
  161. $Excel -> Workbooks -> Quit(); # leave excel
  162. my $et=locatime();
  163. &rep("program completed at $et.",$verb); # wrap up log
  164. close LOG; # close log
  165. ################################################################################
  166. __END__
  167.  
Mar 9 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: CaptainMcBunnyTickle | last post by:
I can't seem to get it to attach to an active perl session. Has anyone been able to get it to debug more than 1 process at a time?
0
by: Maciej Kozinski | last post by:
Hi, has anyone tried to use perlcc.bat with GNU C e.g MinGW? How to set it up to cooperate? Regards, M. -- Maciej Koziński http://strony.wp.pl/wp/maciej_kozinski/
0
by: Eliezer Figueroa | last post by:
Managing Multiple Excel incoming files? I have this situation. I have a client which have several locations they work primary with excel forms and they are thinking in doing reports with them....
9
by: monomaniac21 | last post by:
Hi everyone i'm trying to setup my website to create new webpages dynamically using php but I am have a major problem in that whenever i create a file it is always created locked so that it can...
8
by: Steve Thompson | last post by:
Hello all, I was wondering the differnced there were betwee Active State's python and the open source version of python. Would I have to unistall my opend souce python? Additonally, how does...
2
by: Vmrincon | last post by:
Hi! I need to crete a visual basic .net application to read Excel 2000 files. Does anyone know if I need some kind of driver or some extra file to be able to do it? Thanks a lot!
8
by: jaynemarie | last post by:
I am new to using Active State Perl, I've use Perl on Linux and Unix systems and the same thing on unix systems don't work with active state and I am perplexed. I wrote the code below and I am...
5
by: Doogie | last post by:
Can anoyne tell me why this VBScript will create the file to Excel just fine, but the Excel file will not open up? I am saving it as a xlsx file instead of an xls one and I have the new version of...
0
by: maheshhs2001 | last post by:
For example, Iam opened an Access file, internet explorer, and an excel file, What I required is which one of the file is currently active and we need to record how much time the window was active ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.