Jump to content

Script Doesnt Respond after 5 iterations


Recommended Posts

Please Consider the following script and suggest me what to change as the script doesnt responds after 5 iteration.

The Scenario is that:

1) 2 files have to opened in read mode,one contain URLs(chk.txt) and other contains categories(cat.txt)

2) The script reads the first URL from chk.txt file and sends in FF to open.

3) There in FF, cat is read from cat.txt file and send for selection in drop down menu

4) Then everything works fine after necessary steps, but

this scenario stops working after 5 new urls sent from chk.txt file

Provided that The Script doesn't exits..

#include <file.au3>

#include <FF.au3>

$file =FileOpen("chk.txt",0)

$file1=FileOpen("cat.txt",0)

$report=FileOpen("report.txt",1)

$i=1

$j=1

While 1

_FFConnect()

$line =FileReadLine($file,$i)

$line1=FileReadLine($file1,$j)

If($line=="END")Then

Exit

EndIf

_FFTabAdd()

MouseClick("left",229,43,1) ;For opening URL

send($line,1) ;URL Open from txt file

Send("{ENTER}") ;ENTER for URL

;Sleep(1000)

_FFLoadWait() ;Waiting for Page to be Load

MouseClick("left",239,483,1) ;click Add New Post

_FFLoadWait() ; Waiting for page to be loaded

MouseClick("left",526,537,1) ;clicking on cat drop down

sleep(1000)

send($line1,1) ;sending category from another file

MouseClick("left",530,639,1) ;clicking Next Step

_FFLoadWait()

MouseClick("left",650,507,1) ;clicking empty area for activating page

Sleep(1500)

Send("!z") ;robo form fill submit

_FFLoadWait() ;waiting for submission and page redirection

MouseClick("left",367,627,1) ;Click ON Text Field

sleep(15000) ;waiting for providing info

MouseClick("left",508,476,1) ; CLICK FOR GO BACK submit

_FFLoadWait()

sleep(1000)

_FFConnect()

If _FFIsConnected() Then

_FFLinkClick("GRAND EXPERIENCES offers (abc123)","text")

_FFLoadWait()

Sleep(1500)

EndIf

Sleep(1500)

MouseClick("left",414,45,1) ;copying url

Send("{CTRLDOWN}a{CTRLUP}{CTRLDOWN}c{CTRLUP}{down}")

Local $text=ClipGet()

$line3=FileWriteLine($report,$text)

$i=$i+1

$j=$j+1

WEnd

Link to comment
Share on other sites

You are calling _FFConnect multiple times for each pass of the While loop, which is likely the reason your script is failing. I use the following function in lieu of directly calling _FFConnect and _FFIsConnected:

Func _FFCheckConnection()
Local $result = True

If Not _FFIsConnected() Then
If Not _FFConnect(Default, Default, 3000) Then
$result = False
EndIf
EndIf

Return $result
EndFunc
Link to comment
Share on other sites

Hi Dan

Thanks a lot for your reply,

I implemented your custom function but, it now gives an error after 9 to 10 iterations that:

_FFIsConnected Socket Error 664

Please help me out what to do..

Or may be i wont be defining the function correctly..Please let me know the possible solution

Thanks

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...