Jump to content

The stack overflow problem :/


reverse
 Share

Recommended Posts

Hi.

I'm getting the stack overflow error in my script.

I've read those post with explonations but I am still unable to make my script good.

Here it is:

Opt("SendKeyDelay", 5)

Global $Paused
HotKeySet("{Pause}", "Pause")
Func Pause()
    $Paused = NOT $Paused
While  $Paused
        Sleep (400)
WEnd
EndFunc
$zrobione = FileOpen("zrobione.txt", 1)
$zapis = FileOpen("haslo.txt", 1)
$file = FileOpen("lastnames.txt", 0)
$ID=("ID")
$mail=("email@hotmail.com")
$line = FileReadLine($file)

; Read in lines of text until the EOF is reached

    Run("C:\Program Files\IE.exe")
    
    
FileWrite($zrobione, $file & @CRLF)

start()


Func start()
    
$line = FileReadLine($file)
Do
    Sleep(500)
Until (PixelGetColor(537,606)=0xDFC4D5) And (PixelGetColor(344,500)=0x000000)

Do
Send("{TAB}")
sleep(100)
Send("{TAB}")
Sleep(100)
Send("{TAB}")
Sleep(100)
Send("{TAB}")
Sleep(100)
Send($ID)
Sleep(200)
Send("{TAB}")
Sleep(200)
Send($mail)
Sleep(200)
Send("{ENTER}")

Do
    sleep(200)
until (PixelGetColor(546,577)=0xC3A2b7)
MouseClick("left", 557, 527, 1, 1)
sleep(200)
Send($line)
sleep(500)
MouseClick("left", 495, 581, 1, 1)

do
    sleep(500)
until (PixelGetColor(218,532)=0x67583C) or (PixelGetColor(268,497)=0x5C5281)

if (PixelGetColor(268,497)=0x5C5281) Then
SoundPlay(@WindowsDir & "\media\tada.wav",1)
FileWrite($zapis, @CRLF & "--------" & @CRLF)
FileWrite($zapis, "name: " & $ID & @CRLF)
FileWrite($zapis, "email: " & $mail & @CRLF)
FileWrite($zapis, "odp: " & $line & @CRLF)
FileWrite($zapis, "serv: " & @CRLF)
FileWrite($zapis, "--------" & @CRLF)
EndIf

If (PixelGetColor(218,532)=0x67583C) Then
    sleep(500)
    MouseClick("left", 505, 583, 1, 1)
    
FileOpen("zrobione.txt", 1)     
FileWrite($zrobione, $line & @CRLF)
FileClose($zrobione)

start()

EndIf
Until (PixelGetColor(268,497)=0x5C5281)
EndFunc

When the script reads about 380 line of txt file the error appears and the program stops :/

I would be very happy if you could help me fixing the script :D

Thank you :P

btw: sorry for my english (if something is not understandable I will explain it :) )

Link to comment
Share on other sites

Opt("SendKeyDelay", 5)

Global $Paused

HotKeySet("{Pause}", "Pause")

Func Pause()

$Paused = NOT $Paused

While $Paused

Sleep (400)

WEnd

EndFunc

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

$zapis = FileOpen("haslo.txt", 1)

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

$ID=("ID")

$mail=("email@hotmail.com")

$line = FileReadLine($file)

; Read in lines of text until the EOF is reached

Run("C:\Program Files\IE.exe")

FileWrite($zrobione, $file & @CRLF)

start()

Func start()

$line = FileReadLine($file)

Do

Sleep(500)

Until (PixelGetColor(537,606)=0xDFC4D5) And (PixelGetColor(344,500)=0x000000)

Do

Send("{TAB}")

sleep(100)

Send("{TAB}")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send("{TAB}")

Sleep(100)

Send($ID)

Sleep(200)

Send("{TAB}")

Sleep(200)

Send($mail)

Sleep(200)

Send("{ENTER}")

Do

sleep(200)

until (PixelGetColor(546,577)=0xC3A2b7)

MouseClick("left", 557, 527, 1, 1)

sleep(200)

Send($line)

sleep(500)

MouseClick("left", 495, 581, 1, 1)

do

sleep(500)

until (PixelGetColor(218,532)=0x67583C) or (PixelGetColor(268,497)=0x5C5281)

if (PixelGetColor(268,497)=0x5C5281) Then

SoundPlay(@WindowsDir & "\media\tada.wav",1)

FileWrite($zapis, @CRLF & "--------" & @CRLF)

FileWrite($zapis, "name: " & $ID & @CRLF)

FileWrite($zapis, "email: " & $mail & @CRLF)

FileWrite($zapis, "odp: " & $line & @CRLF)

FileWrite($zapis, "serv: " & @CRLF)

FileWrite($zapis, "--------" & @CRLF)

EndIf

If (PixelGetColor(218,532)=0x67583C) Then

sleep(500)

MouseClick("left", 505, 583, 1, 1)

FileOpen("zrobione.txt", 1)

FileWrite($zrobione, $line & @CRLF)

FileClose($zrobione)

start() <<<<<< ============= THIS IS CALLING THE FUNCTION THAT IS CURRENTLY RUNNING !!!

EndIf

Until (PixelGetColor(268,497)=0x5C5281)

EndFunc

Link to comment
Share on other sites

I know but how to make it in my script?

The problem is when I end my "start" function the "$line = FileReadLine($file)" (which is supposed to move to another line) is not working.

For example the txt file is:

aaa

bbb

ccc

and the FileReadLine func should go from "aaa" through "bbb" to "ccc" but when I end my func (the "start" one) the FileReadLine starts itself all over again (which means it always reads only the "aaa" line).

I need the answer how to fix this problem.

Maybe there is a way to "tell" FileReadLine func to go to another line?

Please help.

PS: I've put the "start" func in "while 1" and "do... until" and Ended it as well but the problem is FileReadLine right now (I tried putting it into while and do until too but it always reads the first line :/

Thx :P

Edited by reverse
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...