Search the Community
Showing results for tags 'broswer'.
-
Hello all and happy holidays! Years ago, a former co-worker of mine wrote a brilliant script to automate several time-consuming tedious tasks. Unfortunately, he left -- and this isn't any of our area of expertise, but he left behind his code for me to tinker with. The script uses Excel and IE together. In a nutshell, it navigates to a particular website, using their search tool to look for a string of text provided by an Excel workbook. If a result is found, it does something, if not found, it does something else. Due to a recent update on this website, the script thinks it's not getting a result from the search, but it actually is! It just can't see it! I believe the problem lies with how the _IETableGetCollection function is being used -- because the search result is a table (screenshot below) -- and the script seems to look for cell 2,2 (I've tried changing it to 3,2, because of that checkbox but that didn't work). The result is there, but it doesn't see or recognize it. Here's the code for the UDF that uses _IETableGetCollection... where I think the problem lies: Func _bbTableDataIndexSearch(ByRef $oObject, $TableIndex, $iColNum, $sSearchString) Opt("WinTitleMatchMode", 2) Sleep(100) Local $oBBTable = _IETableGetCollection($oObject, $TableIndex) Local $aBBTableData = _IETableWriteToArray($oBBTable) _ArrayTranspose($aBBTableData) For $iCountTableData = 1 To UBound($aBBTableData) - 1 Step 1 $aBBTableData[$iCountTableData][$iColNum] = StringStripWS($aBBTableData[$iCountTableData][$iColNum], 7) Next $sSearchString = StringReplace($sSearchString, " ", "") $iIndexList = _ArraySearch($aBBTableData, $sSearchString) - 1 _IEImgClick($oObject, "/images/ci/icons/cmlink_generic.gif", "src", $iIndexList, 1) If @error Then Return 0 MsgBox($MB_ICONWARNING, "Not Found", "Course name " & $sSearchString & " not found.") Else Return 1 $oObject.fireEvent("OnChange") EndIf EndFunc And this is what calls on that function. Every time I run the script, I get the "Else" result, even though the search result is there. For $i = 1 To UBound($aCourseToSearch) - 1 Step 1 If $aCourseToSearch[$i] = "" Then ContinueLoop If $aCourseExistStatus[$i] = "Yes" Then ContinueLoop _bbCourseSearchString($aCourseToSearch[$i]) $CheckCourseExist = _bbTableDataIndexSearch($oIE, 2, 2, $aCourseToSearch[$i]) If $CheckCourseExist = 1 Then $oWorkbook.ActiveSheet.Range("F" & $i + 1).Value = "Yes" $oWorkbook.ActiveSheet.Range("J" & $i + 1).Value = _bbCourseReturnID($aCourseToSearch[$i]) Else $oWorkbook.ActiveSheet.Range("F" & $i + 1).Value = "No" $oWorkbook.ActiveSheet.Range("J" & $i + 1).Value = "-" EndIf _Excel_BookSave($oWorkbook) Sleep(1000) Next Please let me know if more information is needed. Any guidance you guys can provide is greatly appreciated. Thank you!