Sample VBScript Programs

Getting started:

Input string from a user and echo back:   simple.vbs
Simple html file:   simplehtml.html
Get 3 numbers from a user and find the largest:   largestNum.vbs
Put largestNum program in an html file:   largestNum.html
Put largestNum program in an html file using a table:   largestNumTable.html

If you ever find that you have created an infinite loop (so your script keeps running and running and running ...), use ctrl-alt-delete and open the Task Manager. Under the "Processes" tab, end the "wscript" process.

Loop examples:

Using mod and division operators in a zero-terminated loop:   digits.vbs
Using mod and division operators in a loop terminated by string "done":   digits2.vbs
Read in numbers until a negative number is found; determine the average:   avg.vbs
Start with $1, double money everyday until $1,000,000 (practice prob 4):   million.vbs
Find the largest number inputted by a user (practice prob 6):   findLarge.vbs
Display a square of asterisks of a given size (practice prob 9):   prob9.vbs

Subroutine/Function examples:

Find the largest number inputted by a user (practice prob 6), without subroutines:   findLarge.vbs
Find the largest number inputted by a user (practice prob 6), using subroutines:   findLargeWithSubs.vbs
Sort three numbers, without subroutines:   sortThreeNums.vbs
Sort three numbers, using subroutines:   sortThreeNumsWithSubs.vbs
Demonstrate the difference between ByVal and ByRef:   byValbyRef.vbs

Opening files -- MS Excel, text files, and Word doc:

Open a new excel spreadsheet and enter and add two numbers:   openNewExcel.vbs
Open an existing excel spreadsheet:   openOldExcel.vbs
Open an existing excel spreadsheet and loop through cells:   loopCells.vbs
Open an existing text file and loop through lines:   openText.vbs
Open an existing Word doc search for a given string:   searchWord.vbs
Open an existing Powerpoint document and display text of each slide:   openPpt.vbs
Open an existing Powerpoint document and put text of each slide into a word document:   pptToWord.vbs

Array examples:

Demonstrate simple array manipulation using static arrays:   array.vbs
Demonstrate dynamic arrays:   arrayDynamic.vbs
Find something in an array (linear search) (find grade given name):   linearSearch.vbs
        First open a text file with names, e.g., names.txt
        Then open a text file with grades, e.g., grades.txt
Sort a collection of integers using a bubble sort:   bubble.vbs