Practical 8 & Project 4

Task 8.1: Download the code CDO.vbs and explain it to the tutor by drawing a flow chart diagram, or listing its functional modules. The tutor may also pick up a block of lines for you to explain.


Task 8.2 [1 mark]: Extend the program Mail.vbs so that recipients' addresses can be loaded from a text file "emailAddresses.txt", which contains multiple lines and each line may contain multiple email addresses. Multiple email addresses in a line are separated using commas.


Task 8.3 [1 mark]: Suppose that you are given a text file "NamesAndemailAddresses.txt" with a set of records, each of which is in the following format:

    FirstName LastName eMailAddress

For instance, the following is a record:

    Jamie Yang j.yang@uws.edu.au

Extend the program Mail.vbs so that for each record in the file, an email is generated and sent to the associated address with message, like:


   Hello, Jamie Yang,


   This is a test mail.


   your name.


Task 8.4 [2 marks]: The CDO supports hypertext format with embedding images, formatted code snipets, etc. You are required to rewrite the code in 8.2 for handling an email body in html format (not a normal text format). The email body is in file "emailBody.html", where an image "sampleIMG.png" has been inserted. Your program should send out the email composed in "emailBody.html" with the image "sampleIMG.png" inserted inline (not as a plain attachment). Note: for testing, you can place "emailBody.html", "sampleIMG.png", and the script code in the same working folder.

[Think about the scenario, no need for implementation: If there are many images embedded within emailBody.html, is there any effective way for improvement in dealing with those images? By the way, Task 8.4 can certainly be implemented using Powershell; do you want to try it? This is a way to multiply your learning.]


Skills: Recall the job scheduling exercise you did before that you can use for scheduling an email automation task. The Project 4 below has a task which requires you to integrate CDO into HTA context and enjoy GUI convenience; The Project 4 has another task where the email addresses are stored in an Excel file (not a normal text file); you'll learn how to manipulate Excel files. This is to draw your attention that CDO and relevant components offer you a rich set of features for implementation. You can try more if you wish. Please don't use the skills to dispatch spam emails.


Project 4:


Subtask 1 [2 marks]: Write a hypertext application in VBScrit to implement a customer feedback webpage. The HTA should contain the following text fields:

  1.    •   Customer's name

  2.    •   Customer's email address

  3.    •   Subject

  4.    •   Message body

as well as a Send button. The HTA should accept the above information from user's input, generate and send an email to your email address (to signal you).


Subtask 2 [2 marks]: Assume that you are running an interesting website, which attracts a few companies to advertise their products on your website. You charge them monthly according to the numbers of hits on the ads (number of hits * price per hit).  At the end of each month, you send a bill via email to each of the company whose advertisement has been visited for non-zero times.  The information on companies' names, email addresses, numbers of hits and prices per hit is recorded in an excel file (See records.xls for the format of the file). Write a VBSrcipt program to generate all the emails. 


Subtask 3 [2 marks]: This is to continue Subtask 2 with additional requirements. Modify your code for Subtask 2 to do the following extra tasks programatically:

  1.    •   Convert the Spreadsheet file "records.xls" into a PDF format in the same name (as the Spreadsheet file except the extension). There are different ways for automating the task (convert or export or print .xls file to .pdf file) that you can make your own choice.

  2.    •   Zip all the files in the working folder except the VBS file(s). In your code, you can specify the zip file name, e.g. MyZippedFile.zip

  3.    •   Send emails to the recipients in records.xls with an attachment of the zipped file created above.



Marking criteria:


This Practical and Project will be marked (10% of total marks)


Practical 8 Task 8.1-8.4 will be due in week 11 (in tutorial session, no delay is allowed).


Project 4 tasks will be due in week 13. That is, your work must be ready for checking at the beginning of your tutorial class in Week 13 - no delay is allowed. The project MUST be submitted electronically via the unit website by the due time [penalty for late submission applies otherwise]. For submitting your project 4, check 'Assignments', then choose 'Project 04' where you can attach files and perform submission.



A true and proper attempt must be in evidence. Students' performance regarding the task implementation will be individually checked. Students are encouraged to present programs which are fully tested. Any program language errors, run time errors, and logical errors will detract from the full marks. Common coding features like robustness, extensibility, and flexibility are also taken into account for grading. No marks for the project can be obtained without demonstrating your work during laboratory and submitting your work onto vUWS. Marks will be deducted for late submission.