Alex037 Posted January 23, 2018 Share Posted January 23, 2018 Hello, I don't have much experience with AutoIt, and I'm trying to figure out how to search the IE page for specific text. If text is nowhere to be found, hit NEXT and search again (until the text is found). There are no more than 20 pages to be searched for. Based on AutoIT examples I have found in help file, I have come up with: $oIE = _IECreate("https://www.somepage.com") _IELoadWait($oIE) Local $sMyString = "text to be found" For $i = 1 to 20 step 1 Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then ConsoleWrite('found proper link ' & $sLinkText & @CRLF) _IEAction($oLink, "click") ExitLoop ElseIf StringInStr($sLinkText, "NEXT") Then _IEAction($oLink, "click") EndIf Next Next If my logic is OK, the Autoit should search 1st page, and if text is nowhere to be found, it should click NEXT, and then search again. So, it would seem that I should have two "For" loops, but I think I messed it up somewhere on the way. I have also tried with _IELinkClickByText($oIE, "NEXT") in order to avoid 2nd "If" statement, but that doesn`t seem to work either. And yes, this is my 1st attempt with loops.... Any help would be appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now