Glyph Posted April 1, 2009 Share Posted April 1, 2009 #include <IE.au3> $oIE = _IECreate("http://reapercorps.org") $links=2 $sMyString1 = "Admin Area" $sMyString2 = "File uploads: " $oLinks = _IELinkGetCollection($oIE) do For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString1) Then _IEAction($oLink, "click") $Links-=1 ExitLoop EndIf If StringInStr($sLinkText, $sMyString2) Then _IEAction($oLink, "click") $Links-=1 ExitLoop EndIf Next until $Links=0 It will click admin area, then error. --> IE.au3 V2.4-0 Error from function _IEPropertyGet, $_IEStatus_InvalidObjectType This logic seems right to me, but obviously it isn't... tolle indicium Link to comment Share on other sites More sharing options...
Valuater Posted April 1, 2009 Share Posted April 1, 2009 Suggestion.... #1 Add an error handler $MyErrorHandler = _IEErrorHandlerRegister() #2 I'm not sure of the "innertext" on a link... that may not be correct, I dunno, Maybe the text can be used like... If StringInStr($oLink, $sMyString1) Then It is possible that not all links have "innertext" and that errors, as it should, but ?? Just some thoughts here 8) Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 1, 2009 Share Posted April 1, 2009 #include <IE.au3> $oIE = _IECreate("http://reapercorps.org") $links=2 $sMyString1 = "Admin Area" $sMyString2 = "File uploads: " $oLinks = _IELinkGetCollection($oIE) do For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString1) Then _IEAction($oLink, "click") $Links-=1 ExitLoop EndIf If StringInStr($sLinkText, $sMyString2) Then _IEAction($oLink, "click") $Links-=1 ExitLoop EndIf Next until $Links=0 It will click admin area, then error. This logic seems right to me, but obviously it isn't... Once you click on one of the links and navigate away, the objects in the collection are no longer valid. So it should work the first time through, then fail on the second pass. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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