Sie sind auf Seite 1von 55

''******************************************************************************* ******************************************************************************** **************** 'Author : Kishore 'Resuable Script name: This file will be having the Functions whic

will be Calle d in any script 'as on 05/04/11 Functions inn the File '1) TestDrive() "For Gettting the Drive from where the Script is opened,Eg this function will return X drive if QTP script is opened from X drive '2) UpdateEODTestCase_Status : This function is used in EOD test Scripts to Update the Test Case status in EOD_Driver sheet in EOD_Test_Data.xls Workbook '3) UpdateEODTestCaseStatusAndWorkFlowStatus : This function is used in EOD test Scripts to Update the Test Case and Work flow status in EOD_Work_Flows sheet EOD_Test_Data.xls Workbook '4) Check_Status : This function is used in EOD scripts to Checking the Work fl ow status.If workflow status is not Succeeded or failed will wait the script t ell count became zero '5) UpdateExcelCellValue : '6) GetCellIndexUsingColName : 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ******************************************************************************** ******************** Function TestDrive() DriveArray = Split(Environment.Value("TestDir"), ":", -1, 1) TestDrive=DriveArray(0) End Function '******************************************************************************* ******************************************************************************** ******************** 'Script to Update the test data sheet with the test case status Function func_UpdateEOD_TestCaseStatus(testCaseStatus) Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open(TestDrive&":\Test Auto mation\Test data sheets\EOD\EOD.xls") objExcel.Application.Visible = True Set excelSheet1 =objExcel.Worksheets("EOD_Driver") objExcel.Worksheets("EOD_Driver").Select totalRows1 = excelSheet1.UsedRange.Rows.Count For i=2 to totalRows1 Dim myCell1 myCell1 = excelSheet.Cells(i,4) If myCell1 =Environment.value("TestName ") Then excelSheet1.C ells(i,7).value = "Executed" excelSheet1.C ells(i,8).value = testCaseStatus Exit for End If Next objWorkbook.Save

objWorkbook.Close objExcel.Application.Quit End Function '******************************************************************************* ******************************************************************************** ******************** 'Script to Update the test data sheet with the test case status and Work flow s heet with workflow status Function func_UpdateEODTestCase_WorkFlowStatus(testCaseStatus,workFlowStatus) Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open(TestDrive&":\Test Auto mation\Test data sheets\EOD\EOD.xls") objExcel.Application.Visible = True Set excel_sheet =objExcel.Worksheets("EOD_Work_Flows") objExcel.Worksheets("EOD_Work_Flows").Select totalRows = excel_sheet.UsedRange.Rows.Count 'Update the work flow status For i=2 to totalRows Dim myCell myCell =excel_sheet. Cells(i,2) If myCell =Environment.value("WorkFlow_ Name") Then excel_sheet. Cells(i,3).value="Executed" excel_sheet. Cells(i,4).value=workFlowStatus Exit for End If Next objWorkbook.Save 'Update the Test Case status Set excel_sheet_1 =objExcel.Worksheets("EOD_Driver") objExcel.Worksheets("EOD_Driver").Select totalRows_1 = excel_sheet_1.UsedRange.Rows.Count For i=2 to totalRows_1 Dim myCell_1 myCell_1 =excel_sheet_1. Cells(i,4) If myCell_1 =Environment.value("TestNam e") Then excel_sheet_1 .Cells(i,7).value="Executed" excel_sheet_1 .Cells(i,8).value=testCaseStatus Exit for End If Next objWorkbook.Save objWorkbook.Close objExcel.Application.Quit End Function

'******************************************************************************* ******************************************************************************** ******************** 'Checking the Work flow status Function func_CheckStatus(testObject) maxWaitCounter = 100 ' 3 min foundFlag=0 Do while maxWaitCounter >0 wait 1 If Win("services_manager.services_mana").LBox("LBox").GetCellValue(" ByTitle", Environment.value("WorkFlow_Name"),"Status")="Succeeded" or Win("serv ices_manager.services_mana").LBox("LBox").GetCellValue("ByTitle", Environment.va lue("WorkFlow_Name"),"Status")="Failed" Then foundFlag=1 maxWaitCounter = 0 Else maxWaitCounter = maxWaitCounter- 1 foundFlag=0 End If Loop If Else func_CheckStatus = False End If End Function '******************************************************************************* ******************************************************************************** ******************** 'Checking the Task Status Function func_CheckTaskStatus(Test_Object) maxWaitCounter = 50 ' 3 min foundFlag=0 Do while maxWaitCounter>0 wait 1 If Test_Object.GetROProperty("content")="Succeeded" or Test_Object.G etROProperty("content")="Failed" Then foundFlag=1 maxWaitCounter = 0 Else maxWaitCounter = maxWaitCounter - 1 foundFlag=0 End If Loop If Else func_CheckTaskStatus = False End If End Function '******************************************************************************* ******************************************** '---------------------------------------------------------------------------------------------------------------------------------------------------' Name : func_WriteData_AtEOL_CSVFile 'Author : Mohammad Amir foundFlag=1 Then func_CheckTaskStatus = True foundFlag=1 Then func_CheckStatus = True

' Purpose : Write data at each end of line in csv file ' Inputs : strFileName(Source) - The name of the csv file, which ha s to be modified ' arrTranNum - Array variable ' Output : None '---------------------------------------------------------------------------------------------------------------------------------------------------Public Sub func_WriteData_AtEOL_CSVFile(fileName, arrTranNum) 'Variable & constant declaration Dim objFSO Dim objFile, objTextStream Const ForReading = 1 Const ForWriting = 2 Dim index, strC1, loopIndex, arrFileLines() 'Object definition Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(fileName) Set objTextStream = objFile.OpenAsTextStream(ForReading,TristateUseDefau lt) index = 1 If objFSO.FileExists(fileName) Then 'Get file object Set objFile = objFSO.OpenTextFile(fileName, ForReading) 'Get each line into an array Do While Not objFile.AtEndOfStream strC1 = objFile.ReadLine ReDim Preserve arrFileLines(index) If index <> 1 And index <= UBound(arrTranNum)Then word = Split(strC1, ",") strC1 = "" For loopIndex = 0 To UBound(word)-1 strC1 = strC1 & word(loopIndex) & "," Next strC1 = strC1 & arrTranNum(index-1) End If arrFileLines(index-1) = strC1 index = index + 1 strC1 = "" Loop Set objFile = Nothing 'Write content into the file Set objFile = objFSO.OpenTextFile(FileName, ForWriting) For loopIndex = 0 To UBound(arrFileLines) objFile.WriteLine(arrFileLines(loopIndex)) Next

End If 'Reset and release object Set objFile = Nothing objTextStream.Close Erase arrFileLines End Sub '******************************************************************************* *********************************************** '---------------------------------------------------------------------------------------------------------------------------------------------------' Name : func_UpdateExcel_CellValue 'Author : Mohammad Amir ' Purpose : Update cell value in excel using column name ' Inputs : excelPath - Path of excel sheet ' sheetName - Name of the sheet ' rowIndex - Index row ' colName - Column title ' cellValue - Value to be updated ' Output : None '---------------------------------------------------------------------------------------------------------------------------------------------------Public Sub func_UpdateExcel_CellValue(excelPath, sheetName, rowIndex, colName, c ellValue) 'Object definition Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open(excelPath) Set excel_sheet =objExcel.Worksheets(sheetName) 'Find and update cell value objExcel.Worksheets(sheetName).Select totalRows = excel_sheet.UsedRange.Rows.Count colValue = func_GetCellIndex_UsingColName(colName,excel_sheet) excel_sheet.Cells(rowIndex, colValue).Value = cellValue objWorkbook.Save 'Create shell script Set obj = CreateObject("Wscript.Shell") obj.SendKeys "~" 'Reset and release objects objWorkbook.Close objExcel.Application.Quit Set objExcel = Nothing Set obj = Nothing End Sub '******************************************************************************* *************************************************** '---------------------------------------------------------------------------------------------------------------------------------------------------' Name : func_Import_DataSheet() 'Author : Mohammad Amir ' Purpose : Imports a sheet of a specified excel file to a specified sheet in the run-time Data Table ' The data in the imported sheet replaces the data in t he destination sheet ' Inputs : strFileName(Source) - The name of the excel file, which has to be imported ' strSheet(Source) - The name of the Sheet

in the excel file, which has to be imported ' strSheetDest(Destination) - The name of the Sheet in run-time Data Table ' Output : Reporter.ReportEvent - Warning, if excel file not found/ excel import operation fails '---------------------------------------------------------------------------------------------------------------------------------------------------public Sub func_Import_DataSheet (strFileName, strSheet, strDestSheet) ' ' Enable Error Handling On Error Resume Next Error Handling - Checking for file existance strFileStatus = func_Report_FileStatus(strFileName) If (StrComp(strFileStatus, "TRUE", 1) <> 0) Then strRemarks = strFileStatus ' s" ExitTest End If 'Import statement to import data sheet DataTable.ImportSheet strFileName, strSheet, strDestSheet ' Error Handling - Checking for excel sheet import operation strErrorStatus = func_Check_RunTime_Err() If (StrComp(strErrorStatus, "No Error", 1) <> 0) Then Reporter.ReportEvent micFail, "File Not Found", "Run time error " ExitTest End If On Error GoTo 0 End Sub '******************************************************************************* ********************************************************** '---------------------------------------------------------------------------------------------------------------------------------------------------' Name : func_Ticker_Existence 'Author : Mohammad Amir ' Purpose : It checks for ticker existence ' Inputs : lboxObject - List box object ' desktop object - Desktop object ' sheetName - Name of the sheet ' tickerColName - Ticker title name ' tickerValue - Ticker value ' Output : None '---------------------------------------------------------------------------------------------------------------------------------------------------Public Sub func_Ticker_Existence(desktopObject, lboxObject, tickerColName, ticke rValue) 'Define variables index = 1 flag= false Report as warning with error message and stop test run Reporter.ReportEvent micFail, "File not found", "File not exist

'Find ticker value rowCount = Win(desktopObject).LBox(lboxObject).GetROProperty("maxrow") For index = 2 to rowCount If Win(desktopObject).LBox(lboxObject).GetCellValue("ByIndxByTit le",Cstr(index), tickerColName) = tickerValue Then flag = true Exit For End If Next 'Verify ticker existence If flag Then Reporter.ReportEvent micDone, tickerColName&":"&tickerValue&" is available", "Successful" Else Reporter.ReportEvent micFail, tickerColName&":"&tickerValue& " i s not available", "Unsuccessful" ExitTest End If End Sub '******************************************************************************* ********************************************************************* '---------------------------------------------------------------------------------------------------------------------------------------------------' Name : func_Lbox_Value_Existence 'Author : Mohammad Amir ' Purpose : It checks for any lbox value existence ' Inputs : lboxObject - List box object ' desktop object - Desktop object ' sheetName - Name of the sheet ' tickerColName - Ticker title name ' tickerValue - Ticker value ' Output : boolean value '---------------------------------------------------------------------------------------------------------------------------------------------------Public Function func_Lbox_Value_Existence(desktopObject, lboxObject, tickerColNa me, tickerValue) 'Define variables index = 1 flag= false 'Get row count rowCount = Win(desktopObject).LBox(lboxObject).GetROProperty("maxrow") 'Loop through to search the element For index = 2 to rowCount ticker = Win(desktopObject).LBox(lboxObject).GetCellValue(" ByIndxByTitle",Cstr(index), tickerColName) If ticker = "" Then Reporter.ReportEvent micDone, tickerColName & " are n ot available", "Info" Exit Function End If tickerNum = CDbl(ticker) tickerDiff = tickerValue - tickerNum If tickerDiff >= 10 Then thousands = CDbl(func_TrailWithZeros(tickerDiff

)) Else If tickerNum = tickerValue Then flag = true Exit For End If End If If tickerNum <> tickerValue And thousands > 50 And index < rowCount Then Select Case thousands Case 1000 thousands = Int(thousands/20) Case 900 thousands = Int(thousands/10) Case 800 thousands = Int(thousands/10) Case 700 thousands = Int(thousands/10) Case 600 thousands = Int(thousands/10) Case 500 thousands = Int(thousands/10) Case 400 thousands = Int(thousands/10) Case 300 thousands = Int(thousands/10) Case 200 thousands = Int(thousands/10) Case 100 thousands =Int(thousands/5) Case 90 thousands = Int(thousands/5) Case 80 thousands = Int(thousands/5) Case 70 thousands = Int(thousands/5) Case 60 thousands = Int(thousands/5) Case 50 thousands = Int(thousands/5) Case Else thousands = Int(thousands/50) End Select index = index + thousands - 1 If index > rowCount Then index = index - thousands+1 End If End If Next 'Assign value to return from function func_Lbox_Value_Existence = flag End Function '******************************************************************************* ******************** '-------------------------------------------------------------------------------------------------------------------' Name : func_TrailWithZeros()

'Author : Mohammad Amir ' Description : Method replaces digits with zeros except the left most digi t ' Inputs : Number ' Output : Number with trailing zeros '-------------------------------------------------------------------------------------------------------------------Public Function func_TrailWithZeros(num) 'Declare variable Dim divNum(10), index, hundreds 'Initialize variables index = 0 hundreds = 10 'Loop to get no of digits Do While num divNum(index) = Int(num / 10) num = Int(num / 10) hundreds = hundreds * 10 index = index + 1 Loop thousands = divNum(index-2) * (hundreds/100) 'Return from function func_TrailWithZeros = thousands End Function '******************************************************************************* ******************** '-------------------------------------------------------------------------------------------------------------------' Name : func_Report_FileStatus() 'Author : Mohammad Amir ' Description : Checking for file existance ' Inputs : The complete path of the file whose existence is t o be determined ' Output : Returns file name with absolute path with messag e as file doesn't exist if file doesn't exists ' Returns "No Error" if file exists '-------------------------------------------------------------------------------------------------------------------Public Function func_Report_FileStatus(strFileName) Dim objFso 'Object to hold the name of a FileSystemObject Set objFso = CreateObject("Scripting.FileSystemObject") 'Report if file exist If Not (objFso.FileExists(strFileName)) Then func_Report_FileStatus = strFileName & constNotExist Else func_Report_FileStatus = constExist End If End Function '******************************************************************************* ************************************************************* '-------------------------------------------------------------------------------------------------------------------' Name : func_Check_RunTime_Err() 'Author : Mohammad Amir

' Description : Checking for run- time error ' Inputs : None ' Output : Returns as "Error" if run-time error exists ' Returns as "No Error" if doesn't exist '-------------------------------------------------------------------------------------------------------------------Public Function func_Check_RunTime_Err() 'Check if run time error is there If Err.number<> 0 Then func_Check_RunTime_Err = constErr Else func_Check_RunTime_Err = constNoErr End If End Function '******************************************************************************* ****************************************************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_GetCellIndex_UsingColName() 'Author : Mohammad Amir ' Description : Get cell column index using column name ' Inputs : None ' Output : Returns as "Error" if run-time error exists ' Returns as "No Error" if doesn't exist '-------------------------------------------------------------------------------------------------------------------Function func_GetCellIndex_UsingColName(colName,excelObj) 'Get index For index = 1 To excelObj.UsedRange.Columns.Count If(excelObj.cells(1,index).value = colName)Then colIndex = index Exit For End If Next 'Assign value to return from function func_GetCellIndex_UsingColName = colIndex End Function '******************************************************************************* ******************************************************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_GetDeal_ParamName() 'Author : Mohammad Amir ' Description : Get deal capture parameter into an array ' Inputs : None ' Output : None '-------------------------------------------------------------------------------------------------------------------Public Sub func_GetDeal_ParamName() 'Initialize index indexParam = 1 'Apply loop to get parameter from the datatable For index = 1 To DataTable.GetSheet(1).GetParameterCount

If Instr(DataTable.GetSheet(1).GetParameter(index).Name, "DC_") <> 0 Then ReDim Preserve arrParam(indexParam) If DataTable.Value(DataTable.GetSheet(1).GetParameter(in dex).Name) <> "" Then arrParam(indexParam) = DataTable.GetSheet(1).Get Parameter(index).Name indexParam = indexParam + 1 End If End If Next End Sub '******************************************************************************* *************************************************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_GetDealDetail_BottomArea 'Author : Mohammad Amir ' Description : Get deal no or status from trading manager window ' Inputs : status: Line of status for the deal ' strStartPos: Starting po sition of required status ' strEndPos: End position of required status ' Output : Required status from the status line '-------------------------------------------------------------------------------------------------------------------Function func_GetDealDetail_BottomArea(status, strStartPos, strEndPos) 'Assign position if offset is required If offSet="" Then pos=8 Else pos=offSet End If 'Extract required value from the status line endPos = instr (1,status,strEndPos,1) startPos = instr (1,status,strStartPos,1) startPos=StartPos+pos dealNo=mid (status, startPos, (endPos-startPos)) dealNo= trim(dealNo) 'Assign value to return from function func_GetDealDetail_BottomArea = dealNo offSet="" End Function '******************************************************************************* **************************************************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_SaveExcelPath 'Author : Mohammad Amir ' Description : Save excel file in a specified path ' Inputs : strPath: Path for the excel sheet ' Output : Required status from the status line '--------------------------------------------------------------------------------------------------------------------

Public Sub func_SaveExcelPath(strPath) 'Maximize excel object Window("MSExcel").Maximize 'Create shell object Set wshObj = CreateObject("Wscript.Shell") wshObj.SendKeys "^s" wait 1 wshObj.SendKeys strPath wait 2 wshObj.SendKeys "~" wait 1 wshObj.SendKeys "{TAB}" wait 1 wshObj.SendKeys "~" End Sub '******************************************************************************* ******************** '-------------------------------------------------------------------------------------------------------------------' Name : func_SaveExcelPath 'Author : Mohammad Amir ' Description : Get current date folder ' Inputs : None ' Output : Specific date format '-------------------------------------------------------------------------------------------------------------------Function func_CurrentDateFolder() 'Get current date currDate = Win("Trading Manager").TEdit("Current Date:").GetROProperty(" content") dateDir = Cstr(Mid(currDate, 6, 2))&Mid(currDate, 3, 3)&Cstr(Mid(currDat e, 1, 2)) 'Assign value to return from function func_CurrentDateFolder = dateDir End Function '****************************************************************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_Search_UniqueValue_Excel 'Author : Mohammad Amir ' Description : Search value in excel ' Inputs : filePath: excel absolute file path ' searchValue: Value to be searched ' sheetName: Name of excel sheet ' Output : Boolean value '-------------------------------------------------------------------------------------------------------------------Public Function func_Search_UniqueValue_Excel(filePath, searchValue, sheetName) 'Assign value to return from function func_Search_UniqueValue_Excel = false 'Define objects Set appExcel = CreateObject("Excel.Application")

Set objWorkBook = appExcel.Workbooks.Open (filePath)'opens the sheet Set objSheet = appExcel.Sheets(sheetName)' To select particular sheet With objSheet.UsedRange ' select the used range in particular sheet Set objSearch = .Find (searchValue)' data to find For each val in objSheet.UsedRange' Loop through the used range searchValFlag = Instr(1, val.Value, searchValue) If searchValFlag <> 0 Then' compare with the expected d ata func_Search_UniqueValue_Excel = true Exit For End If Set objSearch = .FindNext(val)' next search Next End With 'Reset and release object objWorkBook.Close Set appExcel=Nothing End Function '******************************************************************************* *********************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_SearchString_TextFile 'Author : Mohammad Amir ' Description : This method will search an input string from an specified text file ' Inputs : strTextFilePath: Text absolute file path ' strSearch: Value to be s earched ' Output : Boolean value '-------------------------------------------------------------------------------------------------------------------Public Function func_SearchString_TextFile(strTextFilePath, strSearch) 'Define objects Set fso = CreateObject("Scripting.FileSystemObject") Set txtFileObj= fso.OpenTextFile(strTextFilePath, 1) 'Get bool value regarding file existence boolResult = InStr(txtFileObj.ReadAll,strSearch) 'Return bool value from function If boolResult Then searchAnStringFromATextFile = True Else searchAnStringFromATextFile = False End If txtFileObj.Close() End Function '******************************************************************************* *********************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_CompareExcel_CellByCell() 'Author : Mohammad Amir ' Description : Find a text file,for which only a part of the name is k

nown, in a folder ' Inputs : excelPath1,excelPath2 ' Returns : Returns "flag=0" if cell mistmatch happens ' Returns "flag=1" if two excels matches '-------------------------------------------------------------------------------------------------------------------Public Function func_CompareExcel_CellByCell(excelPath1, excelPath2) ' Creating the objects for excel and worksheets Dim flag flag = 1 Set objExcelCom = CreateObject("Excel.Application") objExcelCom.Visible = True Set objWorkbook1= objExcelCom.Workbooks.Open(excelPath1) Set objWorkbook2= objExcelCom.Workbooks.Open(excelPath2) Set objWorksheet1= objWorkbook1.Worksheets(1) Set objWorksheet2= objWorkbook2.Worksheets(1) 'Matching the two excels cel by cell For Each cell In objWorksheet1.UsedRange If cell.Value <> objWorksheet2.Range(cell.Address).Value Then ' cell.Interior.ColorIndex = 3'Highlights in red color if any changes in cells flag = 0 Reporter.ReportEvent micFail, "Value: "&cell.Value & " from c ell->"&cell.Address&" in file "&excelPath1&" doesnt matched thecell location in file "&excelPath2, "Expected:Excel value should have matched" Else ' cell.Interior.ColorIndex = 0 End If Next 'Returning the Flaf value func_CompareExcel_CellByCell = flag ' Closing the object objWorkbook1.close objWorkbook2.close objExcelCom.Application.Quit set objExcelCom=nothing End Function '******************************************************************************* ******************************************************************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_SearchString_TextFileByString() 'Author : Mohammad Amir ' Description : Search string from a text file based on some text ' Inputs : 1)strFilePath, 2)strSearchString, 3)strCriteri aString ' Returns : Returns "flag=0" if cell mistmatch happens ' Returns "flag=1" if two excels matches '-------------------------------------------------------------------------------------------------------------------Public Function func_SearchString_TextFileByString(strFilePath, strSearchString, strCriteriaString) 'Creating objects Set objFSO = CreateObject("Scripting.FileSystemObject") Set objDictionary = CreateObject("Scripting.Dictionary") Const ForReading = 1 'Opening the file Set objFile = objFSO.OpenTextFile (strFilePath, ForReading)

index = 0 flag = 0 'Search for the string on a given criteria Do Until objFile.AtEndOfStream strNextLine = objFile.Readline objDictionary.Add index, strNextLine arrLine = objDictionary.Items If index = 0 Then If (Instr(1, arrLine(index), strCriteriaString)) Then If (Instr(1, arrLine(index), strSearchString)) T hen flag = 1 Exit Do End If End If Else If (Instr(1, arrLine(index-1), strCriteriaString)) Then If (Instr(1, arrLine(index-1), strSearchString)) Then flag = 1 End If End If End If index = index + 1 Loop File close objFile.Close 'Returning the value func_SearchString_TextFileByString = flag End Function ' '******************************************************************************* ***************************************************************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_VerifyFile_Existence() 'Author : Mohammad Amir ' Description : Search a file in a given folder ' Inputs : 1)folderPath, 2)fileName ' Returns : Returns True if File is found ' Returns False if File is not found ' '-------------------------------------------------------------------------------------------------------------------Function func_VerifyFile_Existence(folderPath, fileName) Dim fso, folderObj, strFile, fileObj func_VerifyFile_Existence = False 'Create objects Set fso = CreateObject("Scripting.FileSystemObject") Set folderObj = fso.GetFolder(folderPath) Set fileObj = folderObj.Files 'searching for the file For Each strFile In fileObj If Strcomp(strFile.Name,fileName) = 0 Then func_VerifyFile_Existence = True Exit For

End If Next End Function '******************************************************************************* ***************************************************** '-------------------------------------------------------------------------------------------------------------------' Name : func_VerifyTextFileExistence_PartialName() 'Author : Mohammad Amir ' Description : Verifies text file existence if only partial part of na me is available ' Inputs : 1)folderPath, 2)fileName 3)fileExt ' Returns : Returns fileName if File is found ' Returns empty string if File is not found ' '-------------------------------------------------------------------------------------------------------------------Function func_VerifyTextFileExistence_PartialName(folderPath, fileName,fileExt) ' Declaring objects and variables Dim fso, folderObj, strFile, fileObj func_VerifyTextFileExistence_PartialName = "" 'Create objects Set fso = CreateObject("Scripting.FileSystemObject") Set folderObj = fso.GetFolder(folderPath) Set fileObj = folderObj.Files 'search for the file name For Each strFile In fileObj If(InStr(strFile.Name,fileName)<>0) And (InStr(strFile.Name,file Ext)<>0) Then func_VerifyTextFileExistence_PartialName = strFile.Name Exit For End If Next End Function '******************************************************************************* ******************************************************************************** ********************** '-------------------------------------------------------------------------------------------------------------------' Name : func_CountFile_PartialName() 'Author : Mohammad Amir ' Description : 'Counts number of file with given file name part and e xtension ' Inputs : 1)folderPath, 2)fileName 3)fileExt ' Returns : Returns number of File found in intCnt ' ' '-------------------------------------------------------------------------------------------------------------------Function func_CountFile_PartialName(folderPath, fileName, fileExt) 'Declaring objects and variables Dim fso, folderObj, strFile, fileObj, intCnt 'Returning the count func_CountFile_PartialName = 0 'Creating objects Set fso = CreateObject("Scripting.FileSystemObject") Set folderObj = fso.GetFolder(folderPath)

Set fileObj = folderObj.Files 'Counting the files intCnt = 0 For Each strFile In fileObj If(InStr(strFile.Name,fileName)<>0) And (InStr(strFile.Name, fil eExt)<>0) Then intCnt = intCnt + 1 End If Next 'Returning the count func_CountFile_PartialName = intCnt End Function '******************************************************************************* ******************************************************************************** ************* '-------------------------------------------------------------------------------------------------------------------' Name : func_CurrentDateRPTFile 'Author : Mohammad Amir ' Description : Get deal capture parameter into an array ' Inputs : None ' Output : Date format '-------------------------------------------------------------------------------------------------------------------Public Function func_CurrentDateRPTFile() 'Get current date currDate = Win("Trading Manager").TEdit("Current Date:").GetROProperty(" content") yr = "20"&Cstr(Mid(currDate, 6, 2)) strMnth = Mid(currDate, 3, 3) 'Select specified month Select Case strMnth Case "Jan" intMnth = "01" Case "Feb" intMnth = "02" Case "Mar" intMnth = "03" Case "Apr" intMnth = "04" Case "May" intMnth = "05" Case "Jun" intMnth = "06" Case "Jul" intMnth = "07" Case "Aug" intMnth = "08" Case "Sep" intMnth = "09" Case "Oct" intMnth = "10" Case "Nov" intMnth = "11" Case "Dec" intMnth = "12"

End Select 'Get date format dateFormat = yr&intMnth&Cstr(Mid(currDate, 1, 2)) CurrentDateRPTFile = dateFormat End Function '******************************************************************************* ******************************************************** '******************************************************************************* *********************************** 'Author : Kishore 'Resuable Script name: func_CheckPreFile_Avaliable 'Resuable Action Description- This Script will check the file is available at t he output folder 'Input Parameters : '1)Predeltafile path 'Creation Date :22/03/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ********************************** Function func_CheckPreFile_Avaliable( preDeltaFilePath) Environment.value("Prfileexist")="" Set Ofso=createobject("scripting.FilesystemObject") '************************************************************************ fileArray = Split(Pre_Delta_File_Path, "\", -1, 1) fileArrayUpperbound=Ubound(fileArray) buildFilePath = "" For ArrayLbound=0 to fileArrayUpperbound-1 If ArrayLbound = fileArrayUpperbound-1Then buildFilePath= buildFilePath & fileArray(ArrayLbound) else buildFilePath= buildFilePath & fileArray(ArrayLbound)& "/" End If Next '************************************************************************ Predeltafilepath=buildFilePath Set prfolder=Ofso.Getfolder(Predeltafilepath) Set Prfile=prfolder.files Prfilename=fileArray(fileArrayUpperbound) For each Prfile in Prfile If Prfile.Name= Prfilename Then Environment.value("Prfileexist")=True Check_Pre_File_Avaliable=preDeltaFilePath Exit for Else Environment.value("Prfileexist")=False End If Next If Environment.value("Prfileexist")=False Then reporter.ReportEvent micFail,"Predelta file " & Prfile & " is not available in the Path: " & Predeltafilepath ,"" Environment.value("Test_Case_Status")="Failed" End If '************************************************************************

End Function '******************************************************************************* ******************************************************************************** **************** 'Author : Kishore 'Resuable Scriptname: func_CheckPre_PostFiles_Avaliable 'Resuable ScriptDescription- This Script will Verify is Pre delta and post delt a files are avaliable are not. 'Input Parameters : '1) Pre_Delta_File_With_Path :Pre delta File path with File Type Eg:"X:\QTPPOC\ Script_Files\Amend_scenario.txt" '2) Post_Delta_File_With_Path :Post delta file path with file type Eg: "X:\QT PPOC\RPT_FILES\20100511_tradelisting_fx.xls" 'Out Put Paramaters: 'Environment.value("Prfileexist") --It will return True if File exist 'Environment.value("Prfileexist") --It will return True if File exist 'Creation Date :22/12/2010 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ******************************************************************************** **************** 'Call Check_Pre_Post_Files_Avaliable("X:\QTPPOC\Script_Files\Amend_scenario1.txt ","X:\QTPPOC\RPT_FILES\20100511_tradelisting_fx1.xls") Function func_CheckPre_PostFiles_Avaliable( Pre_Delta_File_With_Path, Post_Delta _File_With_Path) 'Settting the variable to blank Environment.value("Prfileexist")="" Environment.value("Pofileexist")="" Set Ofso=createobject("scripting.FilesystemObject") '************************************************************************ MyArray = Split(Pre_Delta_File_With_Path, "\", -1, 1) MyArrayUpperbound=Ubound(MyArray) buildFilePath = "" For ArrayLbound=0 to MyArrayUpperbound-1 If ArrayLbound = MyArrayUpperbound-1Then buildFilePath= buildFilePath & MyArray(ArrayLbound) else buildFilePath= buildFilePath & MyArray(ArrayLbound)& "/" End If Next '************************************************************************ 'Searching for pre files Predeltafilepath=buildFilePath Set prfolder=Ofso.Getfolder(Predeltafilepath) Set Prfile=prfolder.files Prfilename=MyArray(MyArrayUpperbound) For each Prfile in Prfile If Prfile.Name= Prfilename Then Environment.value("Prfileexist")=True Exit for Else Environment.value("Prfileexist")=False End If Next '************************************************************************ MyArray = Split(Post_Delta_File_With_Path, "\", -1, 1)

MyArrayUpperbound=Ubound(MyArray) buildFilePath1= "" For ArrayLbound1=0 to MyArrayUpperbound-1 If ArrayLbound1 = MyArrayUpperbound-1Then buildFilePath1=buildFilePath1 & MyArray(ArrayLbound1) else buildFilePath1= buildFilePath1 & MyArray(ArrayLbound1)& "/" End If Next '************************************************************************ 'Searching for Post file Postdeltafilepath=buildFilePath1 Set Pofolder=Ofso.Getfolder(Postdeltafilepath) Set Pofile=Pofolder.files Pofilename=MyArray(MyArrayUpperbound) For each Pofile in Pofile If Pofile.Name=Pofilename Then Environment.value("Pofileexist")=True Exit for Else Environment.value("Pofileexist")=False End If Next If Environment.value("Prfileexist")=False Then reporter.ReportEvent micFail,"predelta file " & Prfilename & " is not avaliable In the Path: "& Predeltafilepath,"" Environment.value("Test_Case_Status")="Failed" End If If Environment.value("Prfileexist")=True Then reporter.ReportEvent micPass,"pretdelta file " & Prfilename & " is avaliable I n the Path: "& Predeltafilepath,"" End If If Environment.value("Pofileexist")=False Then reporter.ReportEvent micFail,"postdelta file " & Pofilename & " is not avaliabl e in the Path: "& Postdeltafilepath ,"" Environment.value("Test_Case_Status")="Failed" End If If Environment.value("Pofileexist")=True Then reporter.ReportEvent micPass,"postdelta file " & Pofilename & " is avaliable in the Path: "& Postdeltafilepath ,"" End If End Function '******************************************************************************* ******************************************************************************** ******************************************************************************** *************** 'Author : Kishore 'Resuable Script name: func_Compare_Pdf_Pick_Actual_File_RunTime 'Resuable Action Description- This Script will compare Excepted PDF with Actual PDF.Actual PDF path and Search string is passed to script and Script will search for the PDF in the path. This script will be used when we don't know the Actual PDF file name completly 'Input Parameters : '1)Pre_Delta_File_Path_With_Name Excepted PDF Path with file type

'2)Post_Delta_File_Path Actual PDF path with wile tfile ype '3)Variable_For_Post_File_Search 'Creation Date :22/03/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ******************************************************************************** ******************************************************************************** *************** Function func_ComparePdf_PickActualFile_RunTime(File1,File2) Dim MyClipboard ,fso, Temp_file, file_location Set MyClipboard = CreateObject("Mercury.Clipboard") MyClipboard.Clear SystemUtil.Run File1 'Opening the first PDF 'wait for PDF to open Call func_Object_Wait(Window("regexpwndtitle:= Adobe Reader","regexpwndc lass:=AcrobatSDIWindow"),"PDF Document not Opened") 'Copy the PDF content Window("regexpwndtitle:= Adobe Reader","regexpwndclass:=AcrobatSDIWindow").T ype micAltDwn + "t" + "z" +"e" + micAltUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Type micCtrlDwn + "a" + micCtrlUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Type micCtrlDwn + "c" + micCtrlUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Close Set fso = CreateObject("Scripting.FileSystemObject") Set Temp_file = fso.CreateTextFile(rootDirName & ":\Test Automation\Temp _files\tempfile1.txt", True) 'Here we need specfy the Temp file path anf temp tx t file name 'Past the Copied test in to txt file Temp_file.Write MyClipboard.GetText wait 2 'Here wait is required MyClipboard.Clear 'Clear the content from MyClipboard SystemUtil.Run File2 'Opening the second PDF 'wait for PDF to open Call func_Object_Wait(Window("regexpwndtitle:= Adobe Reader","regexpwndc lass:=AcrobatSDIWindow"),"PDF Document not Opened") Set MyClipboard = CreateObject("Mercury.Clipboard") MyClipboard.Clear 'Copy the PDF content Window("regexpwndtitle:= Adobe Reader","regexpwndclass:=AcrobatSDIWindow").T ype micAltDwn + "t" + "z" +"e" + micAltUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow").Ty pe micCtrlDwn + "a" + micCtrlUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Type micCtrlDwn + "c" + micCtrlUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Close Set Temp_file = fso.CreateTextFile(TestDrive &":\Test Automation\Temp_fi les\tempfile2.txt", True) 'Here we need specfy the Temp file path anf temp txt f ile name 'Past the Copied test in to txt file Temp_file.Write MyClipboard.GetText wait 2 'Here wait is required ' call the function to Compare the Two temp test files Call func_CompareFiles_Text(rootDirName & ":\Test Automation\Temp_files\temp file1.txt",rootDirName &":\Test Automation\Temp_files\tempfile2.txt")

On Error Resume Next fso.DeleteFile(rootDirName & ":\Test Automation\Temp_files\tempfile1.txt") fso.DeleteFile(rootDirName &":\Test Automation\Temp_files\tempfile2.txt ") Set fso = Nothing MyClipboard.Clear Set MyClipboard = Nothing On Error GoTo 0 End Function '******************************************************************************* ******************************************************************************** *** '******************************************************************************* ******************************************************************************** ******************************************************************************** *************** 'Author : Kishore 'Resuable Script name: func_CompareFiles_Text 'Resuable Action Description- This Script will compare Excepted TXT file with A ctual TXT File.Script will compare the Files Line by Line 'Input Parameters : '1) FilePath1 : First File Name and path with file type '2) FilePath2 : Second file Name and path with file type 'Creation Date :22/03/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ******************************************************************************** ******************************************************************************** *************** ' func_CompareFiles_Text to campare the test files Function func_CompareFiles_Text (FilePath1, FilePath2) dim fso, resultsfile, answerfile, intCounter Set fso = CreateObject("Scripting.FileSystemObject") 'Difine the constants for file read, write ,Append const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 'Open the tempfile1.txt file for Reading set ResultsFile = fso.OpenTextFile (FilePath1, 1) ResultsFile.ReadAll 'Open the tempfile2.txt file for Reading set AnswerFile = fso.OpenTextFile (FilePath2, 1) AnswerFile.ReadAll If ResultsFile.Line = AnswerFile.Line Then ResultsFile.Close AnswerFile.close set AnswerFile = fso.OpenTextFile (FilePath2, 1) set ResultsFile = fso.OpenTextFile (FilePath1, 1) do until ResultsFile.AtEndOfstream and AnswerFile.AtEndOfstream strReadR = ResultsFile.ReadLine strReadA = AnswerFile.ReadLine Counter = 0 LineNotMatch = 0 'Report the Data mich match in the two files If strReadR <> strReadA then Reporter.ReportEvent micFail, strReadR,"Data in file :"

& FilePath1 &" is---" & strReadR & "----------Data in file :"& FilePath2 &" is--" & strReadA Environment.value("Test_Case_Status")="Failed" Counter = 1 LineNotMatch = LineNotMatch + 1 End If Loop If Counter = 0 Then Reporter.ReportEvent micPass, "Text file Comparision", "Both the files have same data" else Reporter.ReportEvent micFail, "Text file Comparision", "Provided Text files are not identical. Line Comparision get failed. Total Mismatch Line s are = " & LineNotMatch End If Else Reporter.ReportEvent micFail, "Text file Comparision" les do not have identical data" Environment.value("Test_Case_Status")="Failed" End If AnswerFile.close ResultsFile.close End Function , "Text file Fi

'******************************************************************************* ***********************************'******************************************** ******************************************************** 'Author : Kishore 'Resuable Script name: func_CompareTXT_PickActualFile_RunTime 'Resuable Action Description- This Script will compare Excepted txt file with Ac tual txt file.Actual txt file path and Search string is passed to script and Scr ipt will search for the txt file in the path. 'Input Parameters : '1)Pre_Delta_File_Path_With_Name Excepted txt file Path with file type '2)Post_Delta_File_Path Actual txt file path with wile tfile ype '3)Variable_For_Post_File_Search 'Creation Date :22/03/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ******************************************************************************** ******************************************************* 'Example 'These date need to get from Excel 'Pre_Delta_File_Path_With_Name="X:\QTPPOC\TXT_compare\RWE TRADING GMBH - LE_01-M ar-2010_CreditNote_4000252.txt" 'Post_Delta_File_Path="X:\QTPPOC\TXT_compare" ''This data need to get from Application 'Variable_For_Post_File_Search="4000253" 'Call Compare_TXT_Pick_Actual_File_RunTime(Check_Pre_File_Avaliable(Pre_Delta_Fi le_Path_With_Name), Check_Post_Files_Avaliable(Post_Delta_File_Path,Variable_For _Post_File_Search)) Function func_CompareTXT_PickActualFile_RunTime (FilePath1, FilePath2) If Environment.value("Prfileexist")=True and Environment.value("Pofileexist")=

True then dim fso, resultsfile, answerfile, intCounter Set fso = CreateObject("Scripting.FileSystemObject") 'Difine the constants for file read, write ,Append const ForReading = 1 const ForWriting = 2 const ForAppending = 8 'Open the Results.txt file for Reading set ResultsFile = fso.OpenTextFile (FilePath1, 1) 'Open the Answers.txt file for Reading set AnswerFile = fso.OpenTextFile (FilePath2, 1) '======================Begin Marking the Test=============== Environment.value("Test_Case_Status")="Pass" 'Perform answer comparison between user's results and the actual answers do until ResultsFile.AtEndOfstream Or AnswerFile.AtEndOfstream strReadR = ResultsFile.ReadLine strReadA = AnswerFile.ReadLine If strReadR <> strReadA then Reporter.ReportEvent micFail, strReadR,"Data in first file is---" & strR eadR & "----------Data in second file is---" & strReadA Environment.value("Test_Case_Status")="Failed" End If Loop IF ResultsFile.AtEndOfstream="True" and AnswerFile.AtEndOfstream="False" Then Reporter.ReportEvent micFail, "Second File :" & FilePath2 & " is Havi ng More number of Lines than First File :" & FilePath1,"" Environment.value("Test_Case_Status")="Failed" End If If ResultsFile.AtEndOfstream="False" and AnswerFile.AtEndOfstream="True"Then Reporter.ReportEvent micFail, "First File :" & FilePath1 & " is Having More number of Lines than Second File :" & FilePath2,"" Environment.value("Test_Case_Status")="Failed" End If AnswerFile.close ResultsFile.close End If End Function '************************************************************************ '******************************************************************************* ****************************************************************************** 'Author : Kishore 'Resuable Function name: func_CompareXL_CSV 'Resuable Action Description- This Script is useed compare the Excepted and ac tual Excel or CSV files 'Input Parameters : '1 )Expected_Excel_Path Expected EXCEL/CSV Path '2) Actual_Excel_Path Actual EXCEL/CSV path 'or '1 )Expected_CSV_Path Expected EXCEL/CSV Path '2) Actual_CSV_Path Actual EXCEL/CSV path 'Creation Date :2212/2010

'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ****************************************************************************** Sub func_CompareXL_CSV (file1 , file2) Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True Set objWorkbook1= objExcel.Workbooks.Open(file1) Set objWorkbook2= objExcel.Workbooks.Open(file2) Set objWorksheet1= objWorkbook1.Worksheets(1) Set objWorksheet2= objWorkbook2.Worksheets(1) 'If the total number of Used data cells in first sheet is more than or equal to second sheet If objWorksheet1.UsedRange.count >= objWorksheet2.UsedRange.count Then For Each cell In objWorksheet1.UsedRange If cell.Value <> objWorksheet2.Range(cell.Address).Value Then Reporter.ReportEvent micFail, "Mismatch found at cell location - " & Replace (cell.Address , "$" ,""),"Data in First File" & cell.Value &"--------"& "Data in the second File" & objWorksheet2.Range(cell.Address).Value Environment.value("Test_Case_Status")="Failed" Else mismatch = False End If Next End If 'If the total number of Used data cells in first sheet is Less than to second sh eet If objWorksheet1.UsedRange.count < objWorksheet2.UsedRange.count Then For Each cell In objWorksheet2.UsedRange If cell.Value <> objWorksheet1.Range(cell.Address).Value Then Reporter.ReportEvent micFail, "Mismatch found at cell location - " & Replace (cell.Address , "$" ,""),"Data in First File" &cell.Value &"--------"&"Data in the second File" & objWorksheet1.Range(cell.Address).Value Environment.value("Test_Case_Status")="Failed" Else mismatch = False End If Next End If objWorkbook1.close objWorkbook2.close objExcel.visible = false set objExcel=nothing End Sub '******************************************************************************* *********************************** 'Author : Kishore

'Resuable Script name: func_Compare_Pdf 'Resuable Action Description- This Script will compare Excepted PDF with Actual PDF 'Input Parameters : '1 )Expeted_Pdf_Path Excepted PDF Path with file type '2) Actual_Pdf_Path Actual PDF path with wile tfile ype 'Creation Date :22/12/2010 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_ComparePdf(file1,file2) 'To get the test drive driveArray = Split(Environment.Value("TestDir"), ":", -1, 1) testDrive = driveArray(0) Dim myClipBoard ,fso, tempFile, file_location Set myClipBoard = CreateObject("Mercury.Clipboard") myClipBoard.Clear SystemUtil.Run file1 wait 1 Window("regexpwndtitle:= Adobe Reader","regexpwndclass:=AcrobatSDIWindow ").Type micAltDwn + "t" + "z" +"e" + micAltUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Type micCtrlDwn + "a" + micCtrlUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Type micCtrlDwn + "c" + micCtrlUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Close Set fso = CreateObject("Scripting.FileSystemObject") Set tempFile = fso.CreateTextFile(testDrive&":\Test Automation\Temp_file s\tempfile1.txt", True) 'Here we need specfy the Temp file path anf temp txt fil e name tempFile.Write myClipBoard.GetText myClipBoard.Clear SystemUtil.Run file2 wait 5 Set myClipBoard = CreateObject("Mercury.Clipboard") myClipBoard.Clear wait 1 Window("regexpwndtitle:= Adobe Reader","regexpwndclass:=AcrobatSDIWindow ").Type micAltDwn + "t" + "z" +"e" + micAltUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Type micCtrlDwn + "a" + micCtrlUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Type micCtrlDwn + "c" + micCtrlUp Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AcrobatSDIWindow" ).Close Set tempFile = fso.CreateTextFile(testDrive&":\Test Automation\Temp_file s\tempfile2.txt", True) 'Here we need specfy the Temp file path anf temp txt fil e name tempFile.Write myClipBoard.GetText wait 2 Call CompareFiles_Text(testDrive&":\Test Automation\Temp_files\tempfile1 .txt",testDrive&":\Test Automation\Temp_files\tempfile2.txt") ' fso.DeleteFile(testDrive&":\QTPPOC\PDF_compare\tempfile1.txt")

'fso.DeleteFile(testDrive&":\QTPPOC\PDF_compare\tempfile1.txt") Set fso = Nothing myClipBoard.Clear Set myClipBoard = Nothing End Function '******************************************************************************* ******************************************************************************** *** ' func_CompareText_Files to campare the test files Function func_CompareText_Files(FilePath1, FilePath2) dim fso, resultsfile, answerfile, intCounter Set fso = CreateObject("Scripting.FileSystemObject") const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 'Open the tempfile1.txt file for Reading set ResultsFile = fso.OpenTextFile (FilePath1, 1) 'Open the tempfile2.txt file for Reading set AnswerFile = fso.OpenTextFile (FilePath2, 1) '======================Begin Marking the Test=============== 'Perform answer comparison between user's results and the actual answers do until ResultsFile.AtEndOfstream and AnswerFile.AtEndOfstream strReadR = ResultsFile.ReadLine strReadA = AnswerFile.ReadLine 'Report the Data mich match in the two files If strReadR <> strReadA then Reporter.ReportEvent micFail, strReadR,"Data in first file is--" & strReadR & "----------Data in second file is---" & strReadA Environment.value("Test_Case_Status")="Failed" End If Loop AnswerFile.close ResultsFile.close End Function '******************************************************************************* ******************************************************************************** **************** 'Author : Kishore 'Resuable Scriptname: func_CheckPostFiles_Avaliable 'Resuable ScriptDescription- This Script will Verify post delta file is avaliabl e are not 'Input Parameters : '2) Post_Delta_File_With_Path :Post delta file path with file type Eg: "X:\QT PPOC\RPT_FILES\20100511_tradelisting_fx.xls" 'Creation Date :22/12/2010 'Modified Details (Date, Details, Line no: Modified by): 'Eg; 'Call func_CheckPostFiles_Avaliable("X:\QTPPOC\RPT_FILES\20100511_tradelisting_f

x1.xls") '******************************************************************************* ******************************************************************************** **************** Function func_CheckPostFiles_Avaliable(Post_Delta_File_With_Path) Environment.value("Pofileexist")="" Set Ofso=createobject("scripting.FilesystemObject") '************************************************************************ 'Getting the File Path myArray = Split(Post_Delta_File_With_Path, "\", -1, 1) myArrayUpperbound=Ubound(myArray) buildFilePath= "" For i=0 to myArrayUpperbound-1 If i = myArrayUpperbound-1Then buildFilePath=buildFilePath & myArray(i) else buildFilePath= buildFilePath & myArray(i)& "/" End If Next '************************************************************************ 'Searching for File Postdeltafilepath=buildFilePath Set Pofolder=Ofso.Getfolder(Postdeltafilepath) Set Pofile=Pofolder.files Pofilename=myArray(myArrayUpperbound) For each Pofile in Pofile If Pofile.Name=Pofilename Then Environment.value("Pofileexist")=True Exit for Else Environment.value("Pofileexist")=False End If Next If Environment.value("Pofileexist")=False Then reporter.ReportEvent micFail,"postdelta file " & Pofilename & " is not avaliable in the Path: " & Postdeltafilepath ,"" Environment.value("Test_Case_Status")="Failed" End If If Environment.value("Pofileexist")=True Then reporter.ReportEvent micPass,"postdelta file " & Pofilename &" is avali able in the Path: " & Postdeltafilepath ,"" Environment.value("Test_Case_Status")="Pass" End If End Function '******************************************************************************* ******************************************************************************** **************** 'Author : Kishore 'Resuable Scriptname: func_CheckPostFiles_Avaliable_RunTime_FileName 'Resuable ScriptDescription- This Script will Verify post delta file is avaliabl e are not.This script is used if we don't know the complete post file name . 'Input Parameters : '1) Postdeltafilepath :Post delta file path Eg: "X:\endrf2d\endurf_env10\out

dir\reports '2) Search_String :Fixed Part Of File Name Eg: EON_Volatality_Update_Status_ 'Creation Date :22/12/2010 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ******************************************************************************** **************** Function func_CheckPostFiles_Avaliable_RunTime_FileName(postDeltaFilePath, searc hString) Environment.value("Pofileexist")=False Set Ofso=createobject("scripting.FilesystemObject") Set poFolder=Ofso.Getfolder(postDeltaFilePath) Set poFile=poFolder.files 'Setting the object for Files in the Folder For each poFile in poFile 'Searching for file in the folder fileExistOrNot=InStr( poFile.Name, searchString) If fileExistOrNot<>0 Then Environment.value("Pofileexist")=True 'Check_Post_Files_Avaliable=poFile.Name func_CheckPostFiles_Avaliable_RunTime_FileName=Postdeltafilepath &"\" & poFile.Name 'This variable is uset before calling the RPT_To_Excel_Convertio n script to conver the RPT to Excel Environment.value("Pat_File_Path_And_Name") = func_CheckPostFile s_Avaliable_RunTime_FileName Environment.value("postFileName")=poFile.Name postFileName=poFile.Name Exit for Else 'If file is not avaliable ' Environment.value("Pofileexist")= False End If Next If Environment.value("Pofileexist")=False Then Reporter.ReportEvent micFail,"postdelta file " & searchString & " is no t avaliable in the Path: " & postDeltaFilePath ,"" Environment.value("Test_Case_Status")="Failed" End If If Environment.value("Pofileexist")=True Then Reporter.ReportEvent micPass,"postdelta file " & searchString &" is ava liable in the Path: " & postDeltaFilePath ,"" Environment.value("Test_Case_Status")="Pass" End If End Function '******************************************************************************* ****************************************************************************** 'Author : Kishore 'Resuable Function name: func_CompareXL_CSV 'Resuable Action Description- This Script is useed compare the Excepted and ac tual Excel or CSV files.This script is used when user passed sheets in the work book 'Input Parameters : '1 )Excepted_Excel_Path (File1) :Excepted EXCEL/CSV Path '2) Actual_Excel_Path(File2) :Actual EXCEL/CSV path '3) WorksheetOne : Sheet name from File 1 '4) WorksheetTwo : Sheet name from file2

'or '1 )Excepted_CSV_Path(File1) : Excepted EXCEL/CSV Path '2) Actual_CSV_Path(File2) : Actual EXCEL/CSV path '3) WorksheetOne : Sheet name from File 1 '4) WorksheetTwo : Sheet name from file2 'Creation Date :2212/2010 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ****************************************************************************** Sub func_CompareXL_CSV_SheetNames_Passed(file1, workSheetOne, file2, workSheetTw o) completeMatch=1 Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True Set objWorkbook1= objExcel.Workbooks.Open(file1) Set objWorkbook2= objExcel.Workbooks.Open(file2) Set objWorksheet1= objWorkbook1.Worksheets(workSheetOne) Set objWorksheet2= objWorkbook2.Worksheets(workSheetTwo) 'If the total number of Used data cells in first sheet is more than or equal to second sheet If objWorksheet1.UsedRange.count >= objWorksheet2.UsedRange.count Then For Each cell In objWorksheet1.UsedRange If cell.Value <> objWorksheet2.Range(cell.Address).Value Then Reporter.ReportEvent micFail, "Mismatch found at cell lo cation - " & Replace (cell.Address , "$" ,""),"Data in File"&file1&"\"&Worksheet One& cell.Value &"---------"& "Data in the second File "&file1&"\"&WorksheetOne & objWorksheet2.Range(cell.Address).Value Environment.value("Test_Case_Status")="Failed" completeMatch=0 Else mismatch = False End If Next End If 'If the total number of Used data cells in first sheet is Less than to second sh eet If objWorksheet1.UsedRange.count < objWorksheet2.UsedRange.count Then For Each cell In objWorksheet2.UsedRange If cell.Value <> objWorksheet1.Range(cell.Address).Value Then Reporter.ReportEvent micFail, "Mismatch found at cell lo cation - " & Replace (cell.Address , "$" ,""),"Data in First File" &cell.Value & "---------"&"Data in the second File" & objWorksheet1.Range(cell.Address).Value Environment.value("Test_Case_Status")="Failed" completeMatch=0 Else mismatch = False End If Next End If If completeMatch=1 Then Reporter.ReportEvent micPass,"Two given files match each other","" End If objWorkbook1.Close objWorkbook2.Close

objExcel.Visible = False Set objExcel = Nothing End Sub '******************************************************************************* ****************************************************************************** 'Author : Kishore 'Resuable Function name: func_CompareXL_APM 'Resuable Action Description- This Script is useed compare the Excepted and ac tual Excel sheets for APM Test cases 'Input Parameters : '1) file1 Excepted EXCEL Path '2) File2 Actual EXCEL path '3) Sheet_Name 'Creation Date :25/01/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ******************************************************************************** ****************************************** Function func_CompareXL_APM(file1, file2, sheetName) Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True Set objWorkbook1= objExcel.Workbooks.Open(file1) Set objWorkbook2= objExcel.Workbooks.Open(file2) Set objWorksheet1= objWorkbook1.Worksheets(sheetName) Set objWorksheet2= objWorkbook2.Worksheets(sheetName) 'If the total number of Used data cells in first sheet is more than or equal to second sheet If objWorksheet1.UsedRange.count >= objWorksheet2.UsedRange.count Then For Each cell In objWorksheet1.UsedRange If cell.Value <> objWorksheet2.Range(cell.Address).Value Then Reporter.ReportEvent micFail, "Mismatch found at cell location - " & Replace (cell.Address , "$" ,""),"Data in First File" & cell.Value &"--------"& "Data in the second File" & objWorksheet2.Range(cell.Address).Value Environment.value("Test_Case_Status")="Failed" Else mismatch = False End If Next End If 'If the total number of Used data cells in first sheet is Less thna to second sh eet If objWorksheet1.UsedRange.count < objWorksheet2.UsedRange.count Then For Each cell In objWorksheet2.UsedRange If cell.Value <> objWorksheet1.Range(cell.Address).Value Then Reporter.ReportEvent micFail, "Mismatch found at cell location - " & Replace (cell.Address , "$" ,""),"Data in First File" &cell.Value &"--------"&"Data in the second File" & objWorksheet1.Range(cell.Address).Value

Environment.value("Test_Case_Status")="Failed" Else mismatch = False End If Next End If objWorkbook1.Close objWorkbook2.Close objExcel.Visible = False set objExcel = Nothing End Function '******************************************************************************* *********************************** 'Author : Kishore 'Resuable Script name: func_CompareXL_CSV_PickActualFile_RunTime 'Resuable Action Description- This Script will compare Excepted Excel/CSV file w ith Actual Excel/CSV file.Actual Excel/CSV file path and Search string is passed to script and Script will search for the Excel/CSV file in the path. 'Input Parameters : '1)Pre_Delta_File_Path_With_Name Excepted Excel/CSV file Path with file type '2)Post_Delta_File_Path Actual Excel/CSV file path with wile tfile ype '3)Variable_For_Post_File_Search 'Creation Date :22/03/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** 'Example 'These date need to get from Excel 'Pre_Delta_File_Path_With_Name="X:\QTPPOC\EXcel_compare\RWE TRADING GMBH - LE_01 -Mar-2010_CreditNote_4000252.pdf" 'Post_Delta_File_Path="X:\QTPPOC\Excel_compare" ''This data need to get from Application 'Variable_For_Post_File_Search="4000253" 'Call Compare_XL_Or_CSV_Pick_Actual_File_RunTime(Check_Pre_File_Avaliable(Pre_De lta_File_Path_With_Name), Check_Post_Files_Avaliable(Post_Delta_File_Path,Variab le_For_Post_File_Search)) Function func_CompareXL_CSV_PickActualFile_RunTime(File1,File2) If Environment.value("Prfileexist")=True and Environment.value("Pofileexist")= True then If File1<>"empty" or File2<>"empty" Then Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True Set objWorkbook1= objExcel.Workbooks.Open(File1) Set objWorkbook2= objExcel.Workbooks.Open(File2) Set objWorksheet1= objWorkbook1.Worksheets(1) Set objWorksheet2= objWorkbook2.Worksheets(1) mismatch = True

'If the total number of Used data cells in first sheet is more than or equal to second sheet If objWorksheet1.UsedRange.count >= objWorksheet2.UsedRange.count Then For Each cell In objWorksheet1.UsedRange If cell.Value <> objWorksheet2.Range(cell.Address).Value Then Reporter.ReportEvent micFail, "Mismatch found at cell lo cation - " & Replace (cell.Address , "$" ,""),"Data in First File" & cell.Value &"---------"& "Data in the second File" & objWorksheet2.Range(cell.Address).Valu e Environment.value("Test_Case_Status")="Failed" mismatch = False End If Next End If 'If the total number of Used data cells in first sheet is Less thna to second sh eet If objWorksheet1.UsedRange.count < objWorksheet2.UsedRange.count Then For Each cell In objWorksheet2.UsedRange If cell.Value <> objWorksheet1.Range(cell.Address).Value Then Reporter.ReportEvent micFail, "Mismatch found at cell lo cation - " & Replace (cell.Address , "$" ,""),"Data in First File" &cell.Value & "---------"&"Data in the second File" & objWorksheet1.Range(cell.Address).Value Environment.value("Test_Case_Status")="Failed" mismatch = False End If Next End If If mismatch <> False Then Reporter.ReportEvent micPass, "Pre - Post file Validaion Passed", "Both files have identical data" End If objWorkbook1.Close objWorkbook2.Close objExcel.Visible = False Set objExcel = Nothing Else Reporter.ReportEvent micFail, "Files are not avaliable ","" End If End If End Function '############################################################################### ################### '******************************************************************************* *********************************** 'Author : Kishore 'Resuable Script name: func_CompareText_Files

'Resuable Action Description- This Script will compare Excepted TXT with Actual TXT 'Input Parameters : '1 )Expeted_Txt Expeted TXT Name with file type '2) Actual_Txt_Path Actual TXTpath with wile tfile ype 'Creation Date :21/02/2012 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** 'Call CompareFiles_Text("X:\QTPPOC\Scripts_for_Demo\Temp_TXT_Files\tempfile3.txt ","X:\Test Automation\Excepeted Files\EOD\tempfile4.txt") Function func_CompareText_Files(FilePath1, FilePath2) dim fso, resultsfile, answerfile, intCounter Set fso = CreateObject("Scripting.FileSystemObject") const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 'Open the Results.txt file for Reading set ResultsFile = fso.OpenTextFile (FilePath1, 1) 'Open the Answers.txt file for Reading set AnswerFile = fso.OpenTextFile (FilePath2, 1) '======================Begin Marking the Test=============== Environment.value("Test_Case_Status")="Pass" 'Perform answer comparison between user's results and the actual answers do until ResultsFile.AtEndOfstream Or AnswerFile.AtEndOfstream strReadR = ResultsFile.ReadLine 'msgbox strReadR strReadA = AnswerFile.ReadLine 'msgbox strReadA If strReadR <> strReadA then Reporter.ReportEvent micFail, strReadR,"Data in file " & FilePa th1 & " is---" & strReadR & "----------Data in file " & FilePath2 & " is---" & strReadA Environment.value("Test_Case_Status")="Failed" End If Loop IF ResultsFile.AtEndOfstream="True" and AnswerFile.AtEndOfstream="Fal se" Then Reporter.ReportEvent micFail, "Second File :" & FilePath2 & "is H aving More number of Lines than First File :" & FilePath1,"" Environment.value("Test_Case_Status")="Failed" End IF If tream="True"Then ResultsFile.AtEndOfstream="False" and AnswerFile.AtEndOfs

Reporter.ReportEvent micFail, "First File :" & FilePath 1 & "is Having More number of Lines than Second File :" & FilePath2,""

Environment.value("Test_Case_Status")="Failed" End If AnswerFile.close ResultsFile.close End Function '****************************************************************************** ********************************************************** Function func_LoadAll_LibFiles() DriveArray = Split(Environment.Value("TestDir"), ":", -1, 1) TestDrive=DriveArray(0) executefile "X:\Test Automation\LIB\Check_Post_Files_Available.vbs" executefile TestDrive & ":\Test Automation\LIB\Check_Pre_Post_Files_Available.vb s" executefile TestDrive & ":\Test Automation\LIB\Common_Functions.vbs" executefile TestDrive & ":\Test Automation\LIB\Compare_XL_CSV.vbs" executefile TestDrive & ":\Test Automation\LIB\Compare_XL_For_APM.vbs" executefile TestDrive & ":\Test Automation\LIB\Compare_XML.vbs" executefile TestDrive & ":\Test Automation\LIB\CompareFiles_Text.vbs" executefile TestDrive & ":\Test Automation\LIB\Object_Exist.vbs" executefile TestDrive & ":\Test Automation\LIB\Pdf_Compare.vbs" executefile TestDrive & ":\Test Automation\LIB\Search_String_Text_File.vbs" executefile TestDrive & ":\Test Automation\LIB\Search_XML.VBS" End Function '******************************************************************************* *********************************** 'Author : Roshni Francis 'Resuable Function: func_Object_Exist 'Resuable Action Description- This action will check whether the object exists o r not 'Input Parameters : 1. Test_Object 'Output Parameters: 1.Test_Object_Status -> Returns 'True' if obj ect exists and if not 'False' 'Creation Date :17/01/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** 'Description: This function will wait for existance of a given object, maximum t ime out is 500 sec. It returns True or False value. Function func_Object_Exist(testObject) maxWaitCounter = 60 foundFlag=0 Do while maxWaitCounter>0 If testObject.Exist(1) Then foundFlag=1 maxWaitCounter = 0 Else maxWaitCounter = maxWaitCounter - 1 foundFlag=0 End If wait 3

Loop If Else func_Object_Exist = False End If End Function '******************************************************************************* *********************************** 'Author : Amit Tiwari 'Resuable Function: func_Object_Present 'Resuable Action Description- 'This function will wait for existance of a given object, maximum time out is 500 sec. If the object does not get displayed after the time out, QTP will report the failed result and Exit from the test script ex ecution 'Input Parameters : 1> Test_Object; 2> Failed _Error_Msg; 3> Passed_Error_ Msg 'Output Parameters: None 'Creation Date :12/03/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** 'Description: 'This function will wait for existance of a given object, maximum time out is 2 min. If the object does not get displayed after the time out, QTP will report the failed result and Exit from the test script execution Function func_Object_Present (testObject, failedErrorMsg) maxWaitCounter = 60 foundFlag=0 Do while maxWaitCounter>0 If testObject.Exist(1) = False Then foundFlag=1 maxWaitCounter = 0 Else maxWaitCounter = maxWaitCounter - 1 foundFlag=0 End If wait 3 Loop If foundFlag=0 Then Reporter.ReportEvent micFail,failedErrorMsg,"" ExitTest End If End Function foundFlag=1 Then func_Object_Exist = True

'******************************************************************************* *********************************** 'Author : Amit Tiwari 'Resuable Function: func_Object_Wait 'Resuable Action Description- 'This function will wait for existance of a given

object, maximum time out is 500 sec. If the object does not get displayed after the time out, QTP will report the failed result and Exit from the test script ex ecution 'Input Parameters : 1> Test_Object; 2> Failed _Error_Msg; 3> Passed_Error_ Msg 'Output Parameters: None 'Creation Date :12/03/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** 'Description: 'This function will wait for existance of a given object, maximum time out is 2 min. If the object does not get displayed after the time out, QTP will report the failed result and Exit from the test script execution Function func_Object_Wait (testObject, failedErrorMsg) maxWaitCounter = 200 foundFlag=0 Do while maxWaitCounter>0 If testObject.Exist(1) = True Then foundFlag=1 maxWaitCounter = 0 Else maxWaitCounter = maxWaitCounter - 1 foundFlag=0 End If wait 3 Loop If foundFlag=0 Then Reporter.ReportEvent micFail,failedErrorMsg,"" ExitTest End If End Function

'******************************************************************************* *********************************** 'Author : Amit Tiwari 'Resuable Function: func_CloseWindow 'Resuable Action Description- 'This function will close/terminate the passed tes t object's window 'Input Parameters : 1> Test_Object; 'Output Parameters: None 'Creation Date :05/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_CloseWindow (testObject) If testObject.Exist Then testObject.Activate testObject.Terminate End If

End Function

'******************************************************************************* *********************************** 'Author : Amit Tiwari 'Resuable Function: func_Clear_Outdir 'Resuable Action Description- 'This function will move all the file present in S ource_Path to Destination_Path 'Input Parameters : 1> Test_Object; 'Output Parameters: None 'Creation Date :05/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_Clear_Outdir(sourcePath, destinationPath) On Error Resume Next Set fsoObject = CreateObject("Scripting.FileSystemObject") fsoObject.MoveFile sourcePath & "\*.*" , destinationPath Set oFolder = fsoObject.GetFolder(sourcePath) Set oFiles = oFolder.Files numberOfFiles = oFiles.Count For each oFiles in oFiles fileNames = fileNames & vblf & oFiles.Name Next If numberOfFiles <> 0 Then Reporter.ReportEvent micWarning, "Clear_Outdir Function" , "Function is unable to move the following files: " & vblf & fileNames End If On error GoTo 0 If err.number <> 0 Then Reporter.ReportEvent micWarning, "Clear_Outdir Function", "Funct ion gets an error." & vblf & "Error Description: " & err.description & vblf & "E rror Number: " & err.number End If End Function '******************************************************************************* ******************************************************************************** **************** 'Author : Anand Dutt Pandey 'Resuable Scriptname: func_Openpdf 'Resuable ScriptDescription- This Script will Verify post delta file is avaliabl e are not.This script will open the seached pdf 'Input Parameters : '1) Postdeltafilepath :Post delta file path Eg: "X:\endrf2d\endurf_env10\out dir\reports '2) Search_String :Fixed Part Of File Name Eg: EON_Volatality_Update_Status_ 'Creation Date :22/12/2010 'Modified Details (Date, Details, Line no: Modified by):

'******************************************************************************* ******************************************************************************** **************** Function func_OpenPDF(Postdeltafilepath ,Search_String) Set Ofso=createobject("scripting.FilesystemObject") Set Pofolder=Ofso.Getfolder(Postdeltafilepath) Set Pofile=Pofolder.files 'Setting the object for Files in the Folder For each Pofile in Pofile 'Searching for file in the folder File_Exist_Or_Not=InStr( Pofile.Name, Search_String) If File_Exist_Or_Not<>0 Then Environment.value("Pofileexist")=True 'Check_Post_Files_Avaliable=Pofile.Name Check_Post_Files_Avaliable=Postdeltafilepath&"\" & Pofile.Name 'This variable is uset before calling the RPT_To_Excel_Convertio n script to conver the RPT to Excel Environment.value("Pat_File_Path_And_Name") = Check_Post_Files_A valiable PostFileName=Pofile.Name Exit for Else 'If file is not avaliable Environment.value("Pofileexist")=False End If Next ' Open the Pdf If Environment.value("Pofileexist")=True Then reporter.ReportEvent micPass,"postdelta file " &" is avaliable in the Path: " & Postdeltafilepath ,"" Environment.value("Test_Case_Status")="Pass" Systemutil.Run Postdeltafilepath & "\" & PostFileName else End IF End Function

'******************************************************************************* ******************************************************************************** **************** 'Author : Amit Tiwari 'Resuable Scriptname: func_SearchString_PDF 'Resuable ScriptDescription- This Script will Verify post delta file is avaliabl e are not.This script is used if we don't know the complete post file name . 'Input Parameters : '1) Postdeltafilepath :Post delta file path Eg: "X:\endrf2d\endurf_env10\out dir\reports '2) Deal_Num :As a Fixed Part Of File Name to search the required file '3) Search_String: Required string to search into PDF file 'Creation Date : 13/04/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* ******************************************************************************** **************** Function func_SearchString_In_PDF (postdeltafilepath , dealNum, searchString) Set oFso=createobject("scripting.FilesystemObject") Set pofolder=oFso.Getfolder(postdeltafilepath) searchString = Split(searchString, ";")

filePresent = 0 Set pofile=pofolder.files 'Setting the object for Files in the Folder For each pofile in pofile 'Searching for file in the folder fileExistOrNot=InStr( pofile.Name, dealNum) If fileExistOrNot<>0 Then Environment.value("pofileexist")=True 'checkPostFilesAvaliable=pofile.Name checkPostFilesAvaliable=postdeltafilepath&"\" & pofile.Name 'This variable is uset before calling the RPT_To_Excel_Convert ion script to conver the RPT to Excel Environment.value("Pat_File_Path_And_Name") = checkPostFilesAv aliable PostFileName=pofile.Name ' Search the required string into PDF file 'Instantiate the Clipboard object Set objCB = CreateObject("Mercury.Clipboard") objCB.Clear ' Open the Pdf File Systemutil.Run postdeltafilepath & "\" & PostFileName 'Set Page Display to Single Page Window("regexpwndtitle:=Adobe Reader","regex pwndclass:=AcrobatSDIWindow").Activate Window("regexpwndtitle:= Adobe Reader","regex pwndclass:=AcrobatSDIWindow").Type micAltDwn + "t" + "z" +"e" + micAltUp 'Select all text in the current page Window("regexpwndtitle:=Adobe Reader","regexp wndclass:=AcrobatSDIWindow").Type micCtrlDwn + "a" + micCtrlUp Wait 3 'Copy the whole text in clipboard Window("regexpwndtitle:=Adobe Reader","regexp wndclass:=AcrobatSDIWindow").Type micCtrlDwn + "c" + micCtrlUp For searchStringIndex = LBound(searchStr ing) to UBound(searchString) 'Get the text from the clipboard using the Cl ipboard object & search for current contract in it pdfSearch = Instr(1, objCB.GetText, sear chString(searchStringIndex)) If (pdfSearch > 0) Then Reporter.ReportEvent micPass, "P DF Search", "Expected data: " & searchString(searchStringIndex) & " is present into Pdf file" Else Reporter.ReportEvent micFail, "P DF Search", "Expected data : " & searchString(searchStringIndex) & " does not p resent into Pdf file" End If Next Window("regexpwndtitle:=Adobe Reader","r egexpwndclass:=AcrobatSDIWindow").Close 'Destroy the clipboard object Set objCB = Nothing filePresent = 1 Exit for Else 'If file is not avaliable End If Next

If filePresent = 0 Then Reporter.ReportEvent micFail,"postdelta file " & dealNum & " is not ava liable in the Path: " & postdeltafilepath ,"" End If End Function '******************************************************************************* *********************************** 'Author : Mohammad Amir 'Resuable Method name: func_SearchString_TextFile.vbs 'Resuable Method Description- This method will search an input string from an sp ecified text file 'Input Parameters : Text file path, Search string 'Output Parameters: Boolean value ''Creation Date :18/01/2011 'Modified Details: '******************************************************************************* *********************************** Public Function func_SearchString_TextFile(strTextFilePath, strSearch) Set fso = CreateObject("Scripting.FileSystemObject") Set txtFileObj= fso.OpenTextFile(strTextFilePath, 1) boolResult = InStr(txtFileObj.ReadAll,strSearch) If boolResult Then searchAnStringFromATextFile = True Else searchAnStringFromATextFile = False End If txtFileObj.Close() End Function '******************************************************************************* ******************************* Function func_Verification_Conf_PDF_File_Name(Postdeltafilepath ,Search_String, Expected_File_Name) Set Ofso=createobject("scripting.FilesystemObject") Set Pofolder=Ofso.Getfolder(Postdeltafilepath) Set Pofile=Pofolder.files 'Setting the object for Files in the Folder For each Pofile in Pofile 'Searching for file in the folder File_Exist_Or_Not=InStr( Pofile.Name, Search_String) If File_Exist_Or_Not<>0 Then Environment.value("Pofileexist")=True 'Check_Post_Files_Avaliable=Pofile.Name Check_Post_Files_Avaliable=Postdeltafilepath&"\" & Pofile.Name File_Name = Split(Check_Post_Files_Avaliable, "\") If Expected_File_Name = File_Name(UBound(File_Name))Then Reporter.ReportEvent micPass, "Confirmation PDF File's name format is co rrect","" else Reporter.ReportEvent micFail, "Confirmation PDF File's name format does not correct","" End If Conf_PDF_File_Name = File_Name(UBound(File_Name)) 'This variable is uset before calling the RPT_To_Excel_Convertio n script to conver the RPT to Excel

Environment.value("Pat_File_Path_And_Name") = Check_Post_Files_A valiable PostFileName=Pofile.Name Exit for Else 'If file is not avaliable Environment.value("Pofileexist")=False End If Next If Environment.value("Pofileexist")=False Then reporter.ReportEvent micFail,"postdelta file " & Search_String & " is not avali able in the Path: " & Postdeltafilepath ,"" Environment.value("Test_Case_Status")="Failed" End If If Environment.value("Pofileexist")=True Then reporter.ReportEvent micPass,"postdelta file " & Search_String &" is avaliable in the Path: " & Postdeltafilepath ,"" Environment.value("Test_Case_Status")="Pass" End If End Function '******************************************************************************* *********************************** 'Author : Anand Dutt Pandey 'Resuable Function: func_VerifyListbox_ColumnNames 'Resuable Action Description- 'This function will validate the coulmn names pres ent under any list box in any screen of Endur 'Input Parameters : 1> Test_Object 2> ScriptName 'Output Parameters: None 'Creation Date :07/04/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** 'Description: 'This function will validate the coulmn names present under any li st box in any screen of Endur Function func_VerifyListbox_ColumnNames(Test_Object,ScriptName) 'Initialize the counter variable ' ISplit the values present in test data sheet for column names statusAction = Split(DataTable.Value("Column_Names",Global), ",") ' Retrieve max column number from application columnCount = Test_Object.GetROProperty ("maxcol") ' Loop for iterating column names as per test data sheet in AUT For index = LBound(statusAction) to UBound(statusAction) counter =0 ' Loop for iterating the column names from application and storing it For jIndex =1 to columnCount cellValueApp = Test_Object.GetCellValue("ByIndx","1",Cstr(jIndex)) ' Compare values from application and excel sheet If Lcase(Trim(cellValueApp)) = Lcase(Trim(statusAction(index))) Then counter =1 Exit for End If Next

'Print the result message If counter = 1 Then Reporter.ReportEvent micPass, ScriptName, "Provided Column Name exsist i n list box.Column name is: " & statusAction(index) else Reporter.ReportEvent micFail, ScriptName,"Provided Column Name does not exsis t in list box.Column name is: " & statusAction(index) End If Next End Function

'******************************************************************************* *********************************** 'Author : Anand Dutt Pandey 'Resuable Function: - func_VerifyColumn_LOV 'Resuable Action Description- 'Verification of lov's present under any column in any list box across application.This function will validate the values present in appllication wrt to test data provided for scenario. 'Input Parameters : 1> testObject; 2> Column Name 3> test Case ID 'Output Parameters: - Pass or Fail 'Creation Date :29/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** 'Example:- Verify_Column_LOV (Win("Window_Invoice").LBox("LBox") , "Staus" ,"TRD _CR84_2-Status Column") Function func_VerifyColumn_LOV(testObject , columnName ,testCaseId) rowCount= testObject.GetRoProperty("maxrow") 'Get row count of list box 'Get cell value from Window list box of status into array seprated by (;) statusAction = Split(DataTable.Value(columnName ,Global), ";") 'Loop through values of array For index = LBound(statusAction) to UBound(statusAction) counter =0 For row = 2 to rowCount cellValue= testObject.GetCellValue("ByIndxByTitle",Cstr(row),columnName) 'Compare values from application and excel sheet If LCase(Trim(cellvalue)) = LCase(Trim(statusAction(ind ex))) Then counter =1 Exit for End If Next 'Print the result message If counter = 1 Then Reporter.ReportEvent micPass, testCaseId , "Value present under column.T his value is:- " & statusAction(index)

Else Reporter.ReportEvent micFail, testCaseId , "Value did not exsist in column, this value:- " & statusAction(index) End If Next End Function

'******************************************************************************* *********************************** 'Author : Amit Tiwari 'Function: func_Failed_Report_With_Screenshot 'Function Description- 'This function will capture a screenshot and paste in the QTP result 'Input Parameters : 1> errdes: Error description 'Output Parameters: None 'Creation Date :02/06/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_Failed_Report_With_Screenshot(errdes) filename = Environment.Value("ResultDir") & Environment.Value("TestName") & Repl ace(Replace(now(), "/", ""), ":", "") & ".png" Desktop.CaptureBitmap filename, true Reporter.ReportEvent micFail, errdes, "&lt;<img src='"& filename & "'>" End Function

'******************************************************************************* ************************************* '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------'Author : Kishore 'Resuable Scriptname: Check_Post_Files_Avaliable_RunTime_File_Name 'Resuable ScriptDescription- This Script will Verify post delta file is avaliabl e or not.This script is used if we don't know the complete post file name . 'Input Parameters : '1) postDeltaFilePath :Post delta file path Eg: "X:\endrf2d\endurf_env10\out dir\reports '2) searchString :Fixed Part Of File Name Eg: EON_Volatality_Update_Status_ 'Return : File path and name and empty string if file not found 'Creation Date :22/12/2010 'Modified Details (Date, Details, Line no: Modified by): '------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Function func_Check_Post_Files_Avaliable_RunTime_File_Name(postDeltaFilePath ,se

archString) Set ofso=createobject("scripting.FilesystemObject") Set poFolder=ofso.Getfolder(postDeltaFilePath) Set poFile=poFolder.files 'Setting the object for Files in the Folder func_Check_Post_Files_Avaliable_RunTime_File_Name="" For each poFile in poFile 'Searching for file in the folder fileExistOrNot=InStr( poFile.Name, searchString) If fileExistOrNot<>0 Then Environment.value("poFileexist")=True 'Check_Post_Files_Avaliable=poFile.Name func_Check_Post_Files_Avaliable_RunTime_File_Name=postDeltaFileP ath&"\" & poFile.Name 'This variable is uset before calling the RPT_To_Excel_C onvertion script to conver the RPT to Excel Environment.value("Pat_File_Path_And_Name") = func_Check _Post_Files_Avaliable_RunTime_File_Name Environment.value("File_Name")=poFile.Name 'PostFileName=poFile.Name Exit for Else 'If file is not avaliable Environment.value("poFileexist")=False End If Next If Environment.value("poFileexist")=False Then reporter.ReportEvent micFail,"Postdelta file with having a partial file name " & searchString & " is not avaliable in the Path: " & p ostDeltaFilePath ,"" Environment.value("Test_Case_Status")="Failed" End If If Environment.value("poFileexist")=True Then reporter.ReportEvent micPass,"Postdelta file with having a partial file name " & searchString &" is avaliable in the Path: " & postDel taFilePath ,"" Environment.value("Test_Case_Status")="Pass" End If End Function '******************************************************************************* ******************************************************** '------------------------------------------------------------------------------------------------------------------------------------------'Author : Kishore 'Resuable Scriptname: func_CheckPreFiles_Avaliable_RunTime_FileName 'Resuable ScriptDescription- This Script will Verify pre delta file is avaliable or not.This script is used if we don't know the complete post file name . 'Input Parameters : '1) preDeltaFilePath :Pre delta file path Eg: "X:\endrf2d\endurf_env10\outdi r\reports '2) searchString :Fixed Part Of File Name Eg: EON_Volatality_Update_Status_ 'Return : File path and name and empty string if file not found 'Creation Date :22/12/2010 'Modified Details (Date, Details, Line no: Modified by): '------------------------------------------------------------------------------------------------------------------------------------------Function func_CheckPreFiles_Avaliable_RunTime_FileName(preDeltaFilePath ,searchS tring)

Environment.value("Prfileexist")=False Set ofso=createobject("scripting.FilesystemObject") Set poFolder=ofso.Getfolder(preDeltaFilePath) Set poFile=poFolder.files 'Setting the object for Files in the Folder func_CheckPreFiles_Avaliable_RunTime_FileName="" For each poFile in poFile 'Searching for file in the folder fileExistOrNot=InStr( poFile.Name, searchString) If fileExistOrNot<>0 Then Environment.value("Prfileexist")=True func_CheckPreFiles_Avaliable_RunTime_FileName=preDeltaFi lePath &"\" & poFile.Name 'This variable is uset before calling the RPT_To_Excel_C onvertion script to conver the RPT to Excel Environment.value("Pat_File_Path_And_Name") = func_Check PreFiles_Avaliable_RunTime_FileName Environment.value("PreFileName")=poFile.Name Exit for End If Next If Environment.value("Prfileexist")=False Then reporter.ReportEvent micFail,"predelta file " & searchString & " is not avaliable in the Path: " & preDeltaFilePath ,"" Environment.value("Test_Case_Status")="Failed" End If If Environment.value("Prfileexist")=True Then reporter.ReportEvent micPass,"predelta file " & searchString &" is avaliable in the Path: " & preDeltaFilePath ,"" Environment.value("Test_Case_Status")="Pass" End If End Function '******************************************************************************* ******************************************************************************** ******* '******************************************************************************* *********************************** 'Author : Shivani Patyal 'Resuable Function: - func_Handle_Alert_PopUp 'Resuable Action Description- 'Handle Alert window by clicking on OK button; if it's error mssg pop-up with object name same as alert throw errorand exit Test C ase 'Input Parameters : 'Output Parameters: 'Creation Date :29/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_Handle_Alert_PopUp() 'Click on ok button of Alert window Do While SwfWindow("AlertWindow").SwfObject("OK").Exist errMsg = SwfWindow("AlertWindow").SwfObject("Mes sage").GetROProperty("content") errStatus = InStr(1, errMsg, "Error")

If errStatus Then Reporter.ReportEvent micFail, "E rror Msg: "&errMsg, "Unsuccesful" ' RunAction "Endur_Logout [General _Module] [General_Module]", oneIteration ' ExitTest msgbox "Error Msg: " & errMsg End If SwfWindow("AlertWindow").SwfObject("OK").Click Loop End Function '******************************************************************************* *********************************** 'Author : Shivani Patyal 'Resuable Function: - func_Uplad_CSV 'Resuable Action Description- 'Upload CSV file for custom volume 'Input Parameters : 1> CSV file name along with Path 'Output Parameters: 'Creation Date :29/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_Uplad_CSV(CSVFilePath) If Win("ask_window.ask_window:File").Exist Then Win("ask_window.ask_window:File").Activate Win("ask_window.ask_window:File").TEdit("*Profil e Spread Sheet:").SetValue CSVFilePath Win("ask_window.ask_window:File").PBut("OK").Cli ck End If End Function

'******************************************************************************* *********************************** 'Author : Anand Dtt pandey 'Resuable Function: - func_ProgressBar_Wait 'Resuable Action Description- This function will wait for progress bar window to dissappear,but this is specific to condiditon when value of field 'TetsObject' attains paricular value, 'termed as 'newValue in this function.\ ' E.g:- This function will wait for progress bar window under Confirmation modu le till Current status event column reach particular value of "Move To SStatus" column. 'Input Parameters : 1> testObject 2> newValue 'Output Parameters: 'Creation Date :29/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_ProgressBar_Wait (testObject , newValue) counter Do While testObject.GetCellValue("ByIndxByTitle", "2" ,"Current Status") <> newV

alue or temp = 60 Wait(3) counter = counter+1 Loop If temp>60 Then Reporter.ReportEvent micFail,"Progress bar issue","New value does not ge t changed in time" End If End Function '******************************************************************************* *********************************************** '-----------------------------------------------------------------------------------------------------------------------------------------'Author : Amit Tiwari 'Resuable Function: func_Move_File 'Resuable Action Description- 'This function will move the file from source to Destination 'Input Parameters : 1> sourcePathWithName ' 2) dest inationPathWithName 'Output Parameters: None 'Creation Date :05/05/2011 'Modified Details (Date, Details, Line no: Modified by): '-----------------------------------------------------------------------------------------------------------------------------------------Function func_Move_File(sourcePathWithName, destinationPathWithName) 'Creating file object Set fsoObject = CreateObject("Scripting.FileSystemObject") 'checj=king for existence If fsoObject.FileExists(sourcePathWithName) Then 'Moving the file set fileObject=fsoObject.GetFile(sourcePathWithName) fileObject.move(destinationPathWithName) Else Reporter.ReportEvent micWarning, sourcePathWithName&"does not ex ist","" End If End Function '******************************************************************************* *********************************** 'Author : Kishore Konka 'Resuable Function: func_Date_Converter(endurCurrentDate) 'Resuable Action Description- 'Convert date from ddMMMyy to YYYYMMDD format 'Input Parameters : 1> endur date 'Output Parameters: None 'Creation Date :05/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_Date_Converter(endurCurrentDate) ' take out day, month & yr from Endur date dd=Left(endurCurrentDate, 2) mm=mid(endurCurrentDate,3,3)

yy=right(endurCurrentDate,2) ' assign MOnth Select Case mm Case "Jan" mm="01" Case "Feb" mm="02" Case "Mar" mm="03" Case "Apr" mm="04" Case "May" mm="05" Case "Jun" mm="06" Case "Jul" mm="07" Case "Aug" mm="08" Case "Sep" mm="09" Case "Oct" mm="10" Case "Nov" mm="11" Case "Dec" mm="12" End Select ' create year in YYYY yy= "20"&yy func_Date_Converter=yy&mm&dd End Function '******************************************************************************* *********************************** 'Author : Kishore Konka 'Resuable Function: func_Date_Converter(endurCurrentDate) 'Resuable Action Description- 'Convert date from ddMMyyyy to ddmmmyy format 'Input Parameters : 1> endur date 'Output Parameters: None 'Creation Date :05/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_Endur_Date_Converter(currentDate) 'get day, month & yr from current date dd=right(currentDate, 2) mm=mid(currentDate,5,2) yy=left(currentDate,4) ' get month in mmm format Select Case mm Case "01" mm="Jan" Case "02" mm="Feb" Case "03"

mm="Mar" Case "04" mm="Apr" Case "05" mm="May" Case "06" mm="Jun" Case "07" mm="Jul" Case "08" mm="Aug" Case "09" mm="Sep" Case "10" mm="Oct" Case "11" mm="Nov" Case "12" mm="Dec" End Select ' year format yy yy= right(yy,2) func_Endur_Date_Converter=dd&mm&yy End Function '******************************************************************************* ******************************************************************************** ** 'It checks for ticker existence Public Function func_Get_RowFromList(winObject, lboxObject, colIndex, colCellVal ue) index = 1 flag= false rowCount = Win(winObject).LBox(lboxObject).GetROProperty("maxrow ") For index = 2 to rowCount If Win(winObject).LBox(lboxObject).GetCellValue( "ByIndx",Cstr(index), colIndex) = colCellValue Then flag = true Exit For End If Next If flag Then Reporter.ReportEvent micDone, ColName&":"&colCel lValue&" is available", "Successful" func_Get_RowFromList=index Else Reporter.ReportEvent micFail, ColName&":"&colCel lValue& " is not available", "Unsuccessful" func_Get_RowFromList=Null End If End Function '******************************************************************************* ******************************************************************************** ********

'-----------------------------------------------------------------------------------------------------------------------------------------------'Author : Kishore Konka 'Resuable Function: func_RunWorkflow_SelectDispatcher 'PreRequisite: Workflow management tab in service manager shoul be opened up in application 'Resuable Action Description- 'This function will select the dispatcher against the given task names. 'Input Parameters : 1> index (row in the application where first task exist) ' 2) arra yTaskNames ' 3)arrayS erverNodeBit 'Output Parameters: None 'Creation Date :05/05/2011 'Modified Details (Date, Details, Line no: Modified by): '-----------------------------------------------------------------------------------------------------------------------------------------------Public Function func_RunWorkflow_SelectDispatcher(index, arrayTaskNames, arraySe rverNodeBit) If index=Null Then Reporter.ReportEvent micFail,"Task: "&arrayTaskNames(0)&" not found.Chec k the task Name","Expected: Task should exist" ExitTest End If For rowCount=0 to Ubound(arrayTaskNames) serverNode=Null 'Importing the EOD Sheet which is having the Server name' with Bit Deta ils 'DataTable.ImportSheet TestDrive&":\Test Automation\Test data sheets\EOD \EOD_Server_Details.xls" ,"EOD_Server_Details" ,"EOD_WFM_Select_Dispatcher [EOD_ WFM_Select_Dispatcher]" serverNodeSheet="EOD_WFM_Select_Dispatcher [EOD_WFM_Select_Dispatcher]" Call func_Import_DataSheet (dataSheetDirPath & "EOD\EOD_Server_Details.x ls", "EOD_Server_Details",serverNodeSheet) eODRowcount = DataTable.GetSheet(serverNodeSheet).GetRowCount For nodeCount=1 to eODRowcount DataTable.GetSheet(serverNodeSheet).SetCurrentRow(nodeCount) 'Getting the server name from Server EOD_Server_Details.xls If Datatable.RawValue("Server_Node_Bit",serverNodeSheet)=arrayS erverNodeBit (rowCount)Then serverNodeName=Datatable.Value("Server_Node_Name",serverNod eSheet) Exit For End If Next Win("services_manager.services_mana").LBox("LBox").CellClick "ByIndxByTi tle",Cstr(index+rowCount),"Dispatcher" Win("Window_DefinitionName").LBox("LBox").CellClick "ByTitle",serverNode Name Next Win("services_manager.services_mana").LBox("LBox").CellClick "ByTitleByIndx",Env ironment.value("WorkFlow_Name"),"1"

Win("services_manager.services_mana").IBut("Save").Click Win("services_manager.services_mana").IBut("Run").Click End Function '******************************************************************************* *********************************************************************** '******************************************************************************* *********************************** 'Author : Kishore Konka 'Resuable Function: func_Get_Current_Date 'PreRequisite: Application should be opened 'Resuable Action Description- Getting the current date from the trading manager 'Input Parameters : None 'Returns: Current Endur Date 'Creation Date :05/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Public Function func_Get_Current_Date() Environment.value("Service_Name")="Trading manager" RunAction "Launch_Service_Manager [General_Module]", oneIteration Set testObject=Win("Trading Manager") If func_Object_Exist(testObject) Then reporter.ReportEvent micDone,"Trading Manager Window Exist","Continue test case execution" Else reporter.ReportEvent micFail,"Trading Manager Window doesn't Exi st","Exiting from test case execution" Environment.Value("Test_Case_Status")="Fail" Call func_UpdateEODTestCase_WorkFlowStatus(Environment.Value("Te st_Case_Status"),Environment.value("Work_Flow_Status")) func_Failed_Report_With_Screenshot("Trading Manager Not avaliabl e") ExitTest End If func_Get_Current_Date=Win("Trading Manager").TEdit("Current Date:").GetR OProperty("content") Call func_CloseWindow(Win("Trading Manager")) End Function '******************************************************************************* ******************************************************************************** *** ' 1/4/2010 to 01MMMYY Function func_Converter_Date(oldDate) currDate=split(oldDate,"/",-1,1) dd=CStr(currDate(0)) If len(dd)=1 Then dd="0"&dd End If

yy= right(currDate(2),2) mm=currDate(1) Select Case mm Case 1 mm="Jan" Case 2 mm="Feb" Case 3 mm="Mar" Case 4 mm="Apr" Case 5 mm="May" Case 6 mm="Jun" Case 7 mm="Jul" Case 8 mm="Aug" Case 9 mm="Sep" Case 10 mm="Oct" Case 11 mm="Nov" Case 12 mm="Dec" End Select func_Converter_Date=dd&mm&yy End Function '#################################### Public function ########################## ### Public Function func_DialogWindow() For i = 0 to 3 If SwfWindow("Olf.Desktop.NativeAccess.Progr").Exist(10) Then If Dialog("Save As").Exist(10) Then Dialog("Save As").WinButton("Cancel").Click End If End If Next End Function '******************************************************************************* *************************************************** '******************************************************************************* *********************************** 'Author : Shivani Patyal 'Resuable Function: func_Store_Data_InExcel 'Resuable Action Description- ''Get data from new deal of Fut/Frd & store data i n excel 'Input Parameters : 1> Directory Path with file name ' 2> where to store data; Environment.Value("Store_InSheet") ' 3> daat to be stored inwhic row; Environment.Value("Store_New_InRow") & Environm ent.Value("Store_Validated_InRow")

'Output Parameters: None 'Creation Date :05/05/2011 'Modified Details (Date, Details, Line no: Modified by): '******************************************************************************* *********************************** Function func_Store_Data_InExcel () Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open(dealCaptureDirPath) Set excel_sheet =objExcel.Worksheets(Environment.Value("Store_In Sheet")) objExcel.Worksheets(Environment.Value("Store_InSheet")).Select TotalRows = excel_sheet.UsedRange.Rows.Count ' store dealnum in data excel colValue = func_GetCellIndex_UsingColName("Deal_Num",excel_sheet ) excel_sheet.Cells(Environment.Value("Store_New_InRow"), colValue ).value = Environment.Value("Deal_Num") excel_sheet.Cells(Environment.Value("Store_Validated_InRow"), co lValue).value = Environment.Value("Deal_Num") ' store buy/sell in data excel buySell=Win("trade_input.trade_input_win:Co_ComFutTran").TEdit(" Buy/Sell").GetROProperty("content") colValue = func_GetCellIndex_UsingColName("Buy_Sell",excel_sheet ) excel_sheet.Cells(Environment.Value("Store_New_InRow"), colValue ).value = buySell 'store trader in data excel trader=Win("trade_input.trade_input_win:Co_ComFutTran").TEdit("T rader").GetROProperty("content") colValue = func_GetCellIndex_UsingColName("Trader",excel_sheet) excel_sheet.Cells(Environment.Value("Store_New_InRow"), colValue ).value = trader 'store Settlementdate in data excel colValue = func_GetCellIndex_UsingColName("Settle_Date",excel_sh eet) excel_sheet.Cells(Environment.Value("Store_New_InRow"), colValue ).value = Environment.Value("Settle_Date") 'save & close workbook objWorkbook.Save 'Keyboard Enter is required, else data is not entered in the exc el ' ' Set obj = CreateObject("Wscript.Shell") obj.SendKeys "~" If Dialog("Microsoft Office Excel").WinButton("Yes").Exist Then Dialog("Microsoft Office Excel").WinButton("Yes").Click End If objWorkbook.Close 'release objects objExcel.Application.Quit Set objExcel = nothing

' End Function

Set obj = nothing

Das könnte Ihnen auch gefallen