Creating a script file
A great program for writing scripts is Notepad++ (this is a windows OS program but since VBS is only for windows, that is okay). Notepad++ will help organize the code give visual clues to write your code.
Running a script file
After writing your script, simply save the file with a .vbs extension. To run the script file, just double click it.
Creating Output – MsgBox
The most common way to display output text to the user is to use a message box. This is a little pop-up window that displays whatever text you want. Example code:
msgbox “Your message.”
Comments are not executed by the computer, however they are very important in good code. They are there for you or other programmers to read in order to keep the code organized and understandable. Simply use a single quotation ‘. Example code:
‘ Write your comment here
After working through the above examples…
Use Notepad++ or some such program and create a script that:
- displays the message “Have a nice day” or “Hello World!” using a message box
- has a comment with your name in it
Save your script file as script1.vbs and run it to test it. Then hand in your code as a .txt file.