I'm attempting to use the CaptureText method to extract data from our Grid component. The problem that I have is there are about 12 rows and 5 columns so I'm trying to find an efficient way to use CaptureText for each field. Currently each time I call CaptureText it is taking 2.5 seconds for each field. This translates into 2.5 minutes to extract all data from our Grid. Below is the code snippet that I'm using to Capture the Text. This same line is repeated for each field and then I have a while loop spin through each record.
Dim cap as String
cap = GUIObject("ClassName=AfxWnd42 Caption='' Index=3").CaptureText(40, 15, 80, 15)
Any help would be appreciated or if there is a better way to implement such logic. We have had Compuware reps attempt to find a more efficient way to read our grid and no luck so I'm afraid this is our last resort. TestParter version is 6.1.0 Build 253. This is legacy software so the Grid is no longer supported.
1. If you want to find and check a value does it exist in a grid/table:
Public Sub CheckTableItemExists(sItem As String, Optional bMatchExactly As Boolean = False)
Dim sText As String
sText = GetTableCellContaining(sItem, bMatchExactly)
Check sText <> "", "Check if item " & sItem & " exists in table", "Check if item " & sItem & " exists in table"
Public Function GetTableCellContaining(sItemText As String, Optional bMatchTextExactly As Boolean = False) As String
Dim sObject As String
Dim iRow As Integer
Dim iCol As Integer
If bMatchTextExactly Then
sObject = "InnerText='" & sItemText & "'"
sObject = "InnerText='*" & sItemText & "*'"
iRow = Object(sObject).row
iCol = Object(sObject).Column
GetTableCellContaining = iRow & "_" & iCol
Public Sub Check(criteria As Boolean, strChkname As String, strComm As String)
If criteria Then
UserCheck strChkname, True, strComm
iNoOfPass = iNoOfPass + 1
UserCheck strChkname, False, strComm
iNoOfFail = iNoOfFail + 1