SubZer0 Posted July 15, 2007 Share Posted July 15, 2007 Hi there, got the following code: #include <IE.au3> $IE = _IECreate("xxx") $links = _IELinkGetCollection($IE) $numlinks = @extended For $link in $links if StringInStr($link.href,"fc.php") <> 0 Then $tan = StringRight($link.href,32) $url = StringFormat("xxx",$tan) _IENavigate($IE,$url) EndIf Next The run through the For loop works fine till when the first time the if statement is called. First time if statement works fine too but after the if statement has finished executing and the next for loop starts i am not able to access link.href (Displayed error: The requested action with this object has failed). Somebody knows why that is so? greetz & thx 4 help Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 15, 2007 Share Posted July 15, 2007 Hi there, got the following code: #include <IE.au3> $IE = _IECreate("xxx") $links = _IELinkGetCollection($IE) $numlinks = @extended For $link in $links if StringInStr($link.href,"fc.php") <> 0 Then $tan = StringRight($link.href,32) $url = StringFormat("xxx",$tan) _IENavigate($IE,$url) EndIf Next The run through the For loop works fine till when the first time the if statement is called. First time if statement works fine too but after the if statement has finished executing and the next for loop starts i am not able to access link.href (Displayed error: The requested action with this object has failed). Somebody knows why that is so? greetz & thx 4 help Your variable $links is a collection object, containing pointers to the link objects (not actual copies of the links). When you execute _IENavigate() to a different page, all those objects become invalid. To do what you are trying (follow every link) you'll have to have a different $IE object for each one, or at least open a new tab for each (if IE7). 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...
SubZer0 Posted July 16, 2007 Author Share Posted July 16, 2007 Ahh thx that was my error in reasoning 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