Jump to content
Sign in to follow this  
Jack023

Can't get the loop done

Recommended Posts

Jack023

Hey all,

I'm  trying almost the whole day to fix the loop.

It opens a site using _iecreate and do some stuff

then their will be a If statement: If the first if statement is true then restart loop

if the Else statement is true then restart loop too.

How can i fix this?

Thanks in advance !

Share this post


Link to post
Share on other sites
Jack023

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


;array read
$x = 1
$y = 2



$sString = FileRead(@DesktopDir & "\5faccs.txt")
$aData = StringSplit($sString, @CRLF & ":")

; Remove @CR's
For $i = 1 To UBound($aData) - 1
    $aData[$i] = StringStripCR($aData[$i])
Next
Local $abc = $aData[$x]
Local $bcd = $aData[$y]

; here is the code that needs to be looped
; here is the code that needs to be looped
; here is the code that needs to be looped
; here is the code that needs to be looped
; here is the code that needs to be looped
; here is the code that needs to be looped
; here is the code that needs to be looped


if WinWaitActive("secret") then
    ProcessClose("iexplore.exe")
    $testing = FileOpen(@DesktopDir & "\userpas.txt", 1)
    $x = $x + 2
    $y = $y +2
; so now i want this:  if this if statement is true, restart the script , else go ahead to the else statement.


Else
    $x = 0

    Do
        Sleep(25)
        Send("{TAB}")
        $x = $x + 1
    until $x = 25
Send("{ENTER}")
;send username and pass into txt file
$paslist = FileOpen(@DesktopDir & "\test.txt", 1)
FileWrite($testing, $aData[$x] & ":" & $aData[$y] & @CRLF)
$x = $x + 2
$y = $y +2



; here the same story ; if this statement is true, restart the script until there are no more arrays to read.
EndIf

like this

Share this post


Link to post
Share on other sites
Kidney

its hard to grasp what you r trying to loop. here is what im understanding:

if $this = True Then

    Restart loop
Else

    Restart loop
EndIf

 

either way the loops gets restarted.

Share this post


Link to post
Share on other sites
Rogue5099

Put your code that you want to be restarted in a Function and call it when you want to restart it.  Then put the If...Then checks inside of a While...Wend or a Do...Until loop.

Share this post


Link to post
Share on other sites
Jack023

I fixed it using this:

made a function

Do

Call("function")

until $i = $countlines

works like a charm !

Thanks ;)

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  

×