Dim args, objExcel, seqNum, ermsNum, homePage, driverDetl, customInput, excelName, noOfRecords, noOfFiles, rarlNotcCount, notcType, vehList, noOfMultiErpOfn, env, noticeNumber, offenderIDno, courtDate
Set args = WScript.Arguments
Set objExcel = CreateObject("Excel.Application")
excelName = args(0)
noOfRecords = args(1)
noticeNumber = args(2)
offenderIDno = args(3)
courtDate = args(4)
noOfFiles = 1
On Error Resume Next
objExcel.workbooks.open excelName
objExcel.visible = True
objExcel.DisplayAlerts = False
Set homePage = objExcel.Worksheets("HomePage")
Set driverDetl = objExcel.Worksheets("DriverDetails")
Set customInput = objExcel.Worksheets("CustomInput")
Set objShell = CreateObject("Wscript.Shell")
WScript.Echo "========================================================================"
WScript.Echo "ROMS - Mention Generation Files"
call copyTheTable("ROMS - Mention Generation Files")
homePage.Cells(20, 7).Value = noticeNumber
homePage.Cells(24, 7).Value = offenderIDno
homePage.Cells(30, 7).Value = courtDate
call generateTestData(noOfFiles)
WScript.Echo "File Generation Complete"
call endTheScript()
Sub endTheScript()
objExcel.Activeworkbook.Save
objExcel.Activeworkbook.Close(0)
objExcel.Quit
WScript.Echo "Completed..!!"
WScript.Quit
End Sub
Function createTestData(fileCount)
WScript.Sleep 1000
for a = 1 to fileCount
if notcType = "RFDP" or notcType = "NTO" then
Randomize
randNum = Int((max-min+1)*Rnd+min)
homePage.Cells(21, 7).Value = "T-" & randNum
end if
WScript.Echo " " & "Test File No.: " & a
objExcel.Run "Sheet1.CommandButton1_Click"
WScript.Sleep 1000
next
if env = "QA" then
objExcel.Run "Sheet1.CommandButton5_Click"
WScript.Sleep 1000
end if
End Function
Function createCustomTestData(filePath, batName, noOfFiles)
call generateTestData(noOfFiles)
if env = "QA" then
call runTheBatch(filePath, batName, noOfFiles, False)
end if
End Function
Function copyFileToTemp(path1, path2, destFldr)
command = "cmd.exe /k move " & path1 & destFldr
objShell.Run command,1,True
End Function
Function copyTheTable(schemaName)
homePage.ComboBox3.value = schemaName
objExcel.Run "Sheet1.CommandButton2_Click"
WScript.Sleep 1000
End Function
Function generateTestData(loopCounter)
for l = 1 to loopCounter
WScript.Echo " " & "Test File No.: " & l
objExcel.Run "Sheet1.CommandButton1_Click"
WScript.Sleep 1000
next
End Function
Function runTheBatch(filePath, batName, noOfBatRun, mode)
if env = "QA" then
command = "cmd.exe /k cd " & filePath
for m = 1 to noOfBatRun
command = command & " & " & batName
next
WScript.Echo " " & "No.of Batch files to run: " & noOfBatRun
command = command & " & EXIT"
objShell.Run command,1,mode
WScript.Sleep 2000
end if
End Function
Function generateTestData(loopCounter)
for l = 1 to loopCounter
WScript.Echo " " & "Test File No.: " & l
objExcel.Run "Sheet1.CommandButton1_Click"
WScript.Sleep 2000
next
End Function