Want to have an original Essay on that topic? Any kind of Paper in no time

Order Now


Program description: Script to show the week of the day, the present day of the week and also the array that outputs all weeks of the week. It also explores the input and output methods using VBscripting and the decision making using the IF-ELSE.

Note – The programme has to be copied to notepad or notepad++ and saved to a file format. The file format should be .vbs that can be achieved by saving as from the file menu. With notepad it is good practice to use quotes (“FileName.vbs”) while naming the file for the extension to work correctly



‘The section covers variables, constants and data type


Option Explicit

Dim Message, result

Dim Title, var1, var2

Define dialog box variables.

Message = “Please enter a path”

Title = “WSH sample user input ”

Var1 = “User input canceled”

var2 = “You entered:” & vbCrLf

Ready to use the InputBox function

InputBox(prompt, title, default, xpos, ypos)

prompt:    The text shown in the dialog box

title:     The title of the dialog box

default:   Default value shown in the text box

xpos/ypos: Upper left position of the dialog box

If a parameter is omitted, VBScript uses a default value.

result = InputBox(Message, Title, “C:\Windows”, 100, 100)

Evaluate the user input.

If result = “” Then    Canceled by the user

WScript.Echo var1


WScript.Echo var2 & result

End If

‘*** End


Loop structures and arrays in details using the days of the week.’The section of the programme checks on the day of the day and remind the user by using looping and array

Also constants and variables are explored further in the section


Define constant and variables.

Const title = “Dear, John !”    User’s name can be changed according to client needs

Dim text

the variable cNotes is used as an array that contains messages for each day of the week.

Dim cNotes

Now we define an array with the daily messages.

cNotes = Array ( _

“Hey, it’s Sunday. Please take a rest, my friend.”, _

“It’s Monday. Let’s begin the week.”, _

“Oops, it’s Tuesday. One day of the week is gone.”, _

“Don’t worry, it’s Wednesday.”, _

“Hurray, it’s Thursday.”, _

“Thank goodness it’s Friday.”, _

“Saturday! Why don’t you relax this weekend?”)

Here we define the date within the welcome message.

text = WeekDayName(Weekday(Now()), False, 1) & _

“, ” & MonthName(Month(Now)) & ” ” & _

Day(Now()) & “, ” & _


Now we append a custom message to the date.

text = text & vbCrLf & vbCrLf & cNotes(Weekday(Now()) – 1)

Display the message.

MsgBox Text, vbOKOnly + vbInformation, title

‘*** End


The section is about vbscript input and output methods are


File Input-Output method implemented, decision making statements are explored using the if-else function and the procedures are explored.

VBScript Write File



Option Explicit

Dim objFSO, objFolder, objShell, objTextFile, objFile

Dim strDirectory, strFile, strText

strDirectory = “f:\logs3”

strFile = “\Summer.txt” the file name to be created on to your computer

strText = “You are smart on your work.” ‘The test that need to be written on the file generated above.

Create the File System Object

Set objFSO = CreateObject(“Scripting.FileSystemObject”)

Check that the strDirectory folder exists

If objFSO.FolderExists(strDirectory) Then

Set objFolder = objFSO.GetFolder(strDirectory)


Set objFolder = objFSO.CreateFolder(strDirectory)

WScript.Echo “Just created ” & strDirectory

End If

If objFSO.FileExists(strDirectory & strFile) Then

Set objFolder = objFSO.GetFolder(strDirectory)


Set objFile = objFSO.CreateTextFile(strDirectory & strFile)

Wscript.Echo “Just created ” & strDirectory & strFile

End If

set objFile = nothing

set objFolder = nothing

OpenTextFile Method needs a Const value

ForAppending = 8 ForReading = 1, ForWriting = 2

Const ForAppending = 8

Set objTextFile = objFSO.OpenTextFile _

(strDirectory & strFile, ForAppending, True)

Writes strText every time you run this VBScript



Bonus or cosmetic section to launch explorer to check file

If err.number = vbEmpty then

Set objShell = CreateObject(“WScript.Shell”)

objShell.run (“Explorer” &” ” & strDirectory & “\” )

Else WScript.echo “VBScript Error: ” & err.number

End If


End of VBScript to for vbscript for file input and output method, decision making and methods.


Function section that displays a message box



Answer = getResponse()

Function getResponse()

Dim answ

timeOut = 10

title = “error!”

button = 2

create object.

Set w = WScript.CreateObject(“WScript.shell”)

getResponse = w.Popup( “Write failure. Try again?”.timeOut.title.button)

End Function

‘**** end of the Function method