Final Project
In this project you need to demonstrate all your knowledge about WSH. You need to write a script that reads a text
file and converts it to either Excel, Word, or HTML format. This script also needs to connect a network printer and
print the file to the printer if needed. The final project consists of two parts. The first part is to be done in class
and the second part is due by Saturday, April 30, 11:59pm.
In class assignment
This script should take one unnamed argument and a set of named arguments. The unnamed argument is a text file
that has the following format: each line of the file contains the name of a student and grades of the student.
fields separated by tabulation symbols. If one or more grades are missed, then you may encounter two or more
sequential tabs. Here is an example of a file
Smith, Bob 87 94 78 23 78
Miller, David 94 78 68 87
Gold, Sam 78 87 68 86
Li, Sheng 99 99 86 68 80
Jonson, Danielle 87 12 78 23 78
Clinton, Bob 94 78 68 87 78
True, Jackie 78 12 68 86
Fisher, Drew 99 99 86 99 80
Your script should start Excel and read the whole file into the excel table. The very first row of the table should
contain names of the columns ("Name Exam1 Exam2 Exam3 Exam4 Exam5 Total AVG"). Please add the Total column
and the AVG column at the end of the table (note that the AVG column contains the Total divided by 5
and not the actual average of the grades) and also add the last row that should contain the average value of each exam
column. You script should also make the table looking good. For example the file above should look like
The named arguments are:
- out - [required] the name of the output file. Just the name, not the extension.
- format [optional] can be of the three choices: Excel, CSV, or HTML.
- If the format is equal to Excel, you don't need to do anything extra but save the file.
- If the format is equal to HTML, you need to save this file in the HTML format.
- If the format is equal to CSV, you need to save this file in text format supported by Excel.
The default value is Excel.
- print - [optional] boolean argument. If this argument is set, you need to print the Excel file before
exiting the Excel application.
- nwprn - [optional] a string argument containing a name of a network printer. If this argument is given,
you script needs to connect this network printer and make it to be a default one before printing. Use '
\\dyke-1\ML-116 for debugging, but please don't print at the debugging stage.
Take-home assignment
If the script is not given enough arguments, it should use ShowUsage() method of the WScript.Arguments
object. That means, of course, that you need to write your script as WSF file and specify all the arguments
of the script inside the <runtime> tag. Please provide extensive information to describe each argument and
provide several examples demonstrating possible usage.
Add two more arguments:
- grade - an optional boolean argument. If this argument is set to true (/grade+) you need to add
one more column Grade to the table. This column should include students' letter grades:
- statistics - an optional boolean argument. If this argument is set to true, you need to add the column
Grade whether the /grade argument was set or not, compute the total number of As, Bs, etc, and
create a pie-chart with the number of grades. For example, the pie-chart for the input above should be
Additional notes
- You may use either JScript or VBScript for this project or both.
- You have to use try...catch statements to handle all possible errors.
- You should not think that the input file has exactly 4 lines. It may have any number of lines.
- You should not think that students have exactly 5 exams. They may have more that 5 or less. In this case, you
of course should divide Total by the number of the exams.
- I wouldn't recommend to use Perl in this project in order to parse the input file. Since the format of the input file
is assigned, it would be easier to use method split() of the String object.
- Although it is possible to make Excel compute the letter grades based on the value of the AVG column and
count how many of each grade we have. It's probably easier to do it within the JScript.