Project #7: Yet another Apache log analyzer

Yes, in this project you again need to write a script that does some analysis of an Apache log file. However, this time you need to find out how many requests the server experienced between 12am and 1am, 1am and 2am, etc, and then create a new Excel spread sheet and insert this information into the spread sheet as shown on Figure below:
Then all the entered data need to be converted into a chart. In order to do that in Excel select all the cells that contain information about the hits and click on Insert/Chart.
Then follow instructions of the chart wizard. NB: Please note that the script should do that through the ActiveX Object Excel.Application.

When the chart is created save it as either HTML file or XLS file depending on the named parameter Format which takes either HTML or XLS values. Yes, you do need to use named and unnamed parameters as well as method ShowUsage() if not enough arguments are provided. Your script should take only one required parameter - name of the file to analyze, and one optional parameter - the output format. Thus, a user can run the script as

\> analyze_this.wsf access.log
or like this
\> analyze_this.wsf /Format:HTML access.log

In this project you need to illustrate your ability to:

Note: I would really recommend to use PerlScript to do all the work with the log file. You have done similar things and Perl is more handy for this purpose. However, I run into a problem when tried to pass an array from PerlScript to JScript. This probably happens due to different format of arrays for these languages. I found my way around, though. I organized a global array inside the PerlScript and Perl function analyse_log() put all the data into the array. And then, I wrote a simple Perl function get_array_element() that returns a particular element of the array into the JScript. Here is a sample code that illustrates the idea:
<job>
<script language="PerlScript">
 	@counter = ();

 	sub analyze_log
 	{
 		$name = shift;
 		print "Analysing file $name\n";
		# instead of this loop you need to read the file and do the counting
 		for($i=0;$i<24;$i++){
 			$counter[$i] = 12*$i+3;
 		}
 	}

 	sub get_array_element
 	{
 		return $counter[shift];
 	}
</script>
<script language="JScript">
	WScript.Echo("Let's start ...");
	analyze_log("access.log");
	for(i=0;i<24;i++)
		WScript.Echo(i + ": " + get_array_element(i));
</script>
</job>