continyu Posted July 13, 2010 Share Posted July 13, 2010 (edited) Hi there, this code runs at first time but fails in second... $oIE = _IECreate("www.somesite.com") $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Sleep(1000) $findlink = StringInStr($oLink.href, "http://www.somesite.com/some.php?") If $findlink = 0 Then Sleep(10) Else _IEAction($oLink,"click") MsgBox(0,"click","done") _IENavigate($oIE,$oLink) $add = _IEGetObjByName($oIE,"add") _IELinkClickByText($oIE,"[ Add a personal message ]") $pmsgform = _IEFormGetCollection($oIE,6) $pmsgbox = _IEFormElementGetObjByName($pmsgform,"message") _IEFormElementSetValue($pmsgbox,$pmsg) _IEAction($add,"click") _IELoadWait($oIE) _IENavigate($oIE,"www.somesite.com") _IELoadWait($oIE) $oLinks = _IELinkGetCollection($oIE) EndIf Next I get this error from console (34) : ==> The requested action with this object has failed.: line 34 is $findlink = StringInStr($oLink.href, "http://www.somesite.com/some.php?") Is there something wrong in principle or it's something about site? Edited July 13, 2010 by continyu Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 13, 2010 Share Posted July 13, 2010 (edited) If you navigate IE at all, the object references become invalid ($oIE, $oForm, $oLinks, $oLink, etc.). If you want to make some use of the links on a page, do it in a separate instance (or tab), or get a collection of all the href strings saved off before you start navigating them.Edit: $oIE is not invalidated, but everything else under it is. Edited July 13, 2010 by PsaltyDS 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