Sign in to follow this  
Followers 0
fcg

Intermittent "WEnd^ ERROR" during _IEFormSubmit() loop.

3 posts in this topic

Hello,

I'm trying to create an application that automatically does random searches. However I get an intermittent "WEnd^ ERROR" error when running it. I believe it is related to the '_IEFormSubmit()" function but am not sure. I also tried with the "For..Next" loop with the same result. Any ideas on how to get rid of this error are greatly appreciated!

#include <IE.au3>
#include <String.au3>
#include <File.au3>
#include <Array.au3>

Global $aArray1
Local $newarray[1]
Local $oIE1 = _IECreate("http://www.news.google.com")

$tempfile = FileOpen(@TempDir & "\tempdata.txt", 2)
FileWrite($tempfile, _IEBodyReadHTML($oIE1))

FileClose($tempfile)

For $x = 1 To _FileCountLines(@TempDir & "\tempdata.txt")
    $line = FileReadLine(@TempDir & "\tempdata.txt", $x)
    If StringInStr($line, ';ict=clu_bl"> ') > 0 Then
        $aArray1 = _StringBetween($line, 'ict=clu_bl"> ', '&nbsp')
        _ArrayAdd($newarray, $aArray1[0])
    EndIf
Next
_IEQuit($oIE1)
$newarray2 = _ArrayUnique($newarray)
Local $oIE2 = _IECreate("http://www.bing.com")
$count = 0
while $count <> 20
    $r = Random(2, UBound($newarray2) - 1)
    Local $oForm = _IEFormGetCollection($oIE2, 0)
    Local $oQuery1 = _IEFormElementGetCollection($oForm, 0)
    _IEFormElementSetValue($oQuery1, $newarray2[$r])
    _IEFormSubmit($oForm)
    Sleep(5000)
    $count = $count + 1
WEnd
_IEQuit($oIE2)


 

Share this post


Link to post
Share on other sites



Upgrade to a newer version of AutoIt...

Share this post


Link to post
Share on other sites

Thanks Danp2, That seems to have fixed it.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0