I have taken 3 tests as a example for doing batch run. They are
1. Display -It will display a message in a word doc.
2. DisplayDate - It will display a date and time in a Notepad
3. Multiplication - It will display a mathematical table in Notepad
I converted them in respective funcitons and saved in notepad as a .vbs file.
(in C:\VBLibraryFiles\)
And i wrote a VBS Finction that is called above 3 functions and saved as a callAll.vbs
(in C:\VBLibraryFiles\)
Before running the test I loaded all files into resource tab
callAll() 'Here i am just calling callAll function which is defined in callAll.vbs file
**********************
Display.vbs -
public funciton display()
set WordObj = CreateObject("Word.Application")
WordObj.visible = true
Set wordDoc = WordObj.Documents.Add
WordDoc.Range.InsertBefore "Hi Good Morning"
WordDoc.SaveAs "C:\Greetings.doc"
WordDoc.quit
Set wordObj = Nothing
End Function
***********************
DisplayDate.Vbs -
Public Function displayDate()
Set fso = createObject("Scripting.filesystemObject")
Set fptr = fso.createTextfile("C:\Sample.txt")
a = FormatDateTime(Date,1)
fptr.writeLine a
End Function
*******************************
Multiplication.Vbs -
Public Function multiplication()
Set obj = createObject("Scripting.filesystemObject")
Set of = obj.createTextFile("C:\mat.txt")
For i=1 to 10
x=5*1
of.writeLine "5 * "&i&" = "&x
Next
End Function
*****************************
CallAll.Vbs -
Public Function callAll()
display()
msgbox "Test 1 is pass"
displayDate()
msgbox "Test 2 is pass"
multiplication()
msgbox "Test 3 is pass"
End Function
No comments:
Post a Comment