Project 6
This project tests your ability to
- work with command line arguments using all features of the
Arguments object;
- control applications using appropriate methods of the
WshShell object;
- deal with network resources (map printers and set a default
printer).
Please write a script named txt2rtf.wsf that:
- takes the following arguments:
- name of a text file
- font family in the form /fontfamily="Roman"
- font size in the form /fontsize=12
- font style in the form /fontstyle=bold
- name of a network printer in the form /nwprn=\\server\printer
- print command in the form /print+ or /print-
- save command in the form /save+ or /save-
- executes the WordPad and loads the specified text file into it;
- changes the font of the document according to the command line
argumetns (the values shown above are the default values for
these arguments);
- map the network printer (if specified) and set it as teh default
printer;
- if the "print" argument set to true, print the document;
- if the "save" argument save to true (default value), save the
formatted document as .rtf file.
Additional requirements are:
- describe all your arguments as the script usage in the
<runtime> section of your .wsf file, make
sure that the script prints the usage message if no argument is
given (the only required argument is the file name);
- please handle all the possible errors using the try...catch
construct.