Sukarn
Joined: 16 Jun 2007 Posts: 35
|
Posted: Sun Jul 01, 2007 5:31 pm Post subject: Variable going blank or disappearing. |
|
|
This is a subroutine in a script I wrote for automating some stuff. The original script is supposed to check a webpage to see how many times its supposed to do a job, then start doing it. In case something interrupts it and after 60 tries its not able to do the job then it should exit the subroutine and return to the routine that called it. The routine then restarts the script with checking how many times the job has to be done again (the website is scanned again). All that is working fine, except its not able to find out the number of times the subroutine has run, hence its not able to exit the subroutine after 60 tries if the word "Click" is not found.
I placed a message box here to check whether the value of i was incrementing correctly and found out that the variable just goes blank after the loop is completed once.
Is this just bad scripting on my part, something I scripted wrong? I've been trying to figure out whats going wrong for two days now.
| Code: | Check:
{
i := 0
Loop
{
i := %i% + 1
CK = 0
Clipboard = 0
Click 1269,177
Sleep 500
Click 1269,177
Sleep 500
Send ^a^c
clipboard = %clipboard%
Loop, parse, Clipboard, `n, `r
{
If InStr(A_LoopField, "Click")
{
number = %A_LoopField%
CK = 1
}
}
Click 1269,177
If CK
{
ImageSearch, X, Y, 7, 165, 1277, 232, %ImageFile%
Click %X%,%Y%
Err = 0
Break
}
Else If i > 60
{
Err = 1
Break
}
MsgBox, %i%
}
}
Return |
Last edited by Sukarn on Sun Jul 01, 2007 5:42 pm; edited 1 time in total |
|