Sign in to follow this  
Followers 0
SkellySoul

For...Next...Exits

4 posts in this topic

#1 ·  Posted (edited)

For whatever reason when I call the function with the hotkey , it works just fine...however once the function has ran it doesn't go back to the 'while loop' , instead it exits and gives no warning.

#include <Misc.au3>
#include <Array.au3>
 
;_Singleton(@ScriptName)
 
HotKeySet("{HOME}", "_Pre")
 
While 1
Sleep(1000)
WEnd
 
Func _Pre()
Local $Array[8] = [".", "n", "m", "Switch", "v", "c", "Switch", "Main"]
;_ArrayDisplay($Array) ; Debug
 
For $i = 0 To UBound($Array) +1
If $Array[$i] = "Main" Then
Send("/")
Sleep(500)
ElseIf $Array[$i] = "Switch" Then
Sleep(1000)
Send("w")
Sleep(1000)
Else
Send($Array[$i])
Sleep(300)
MouseClick("Right")
Sleep(500)
EndIf
Next
EndFunc
Edited by SkellySoul

Share this post


Link to post
Share on other sites

That should be UBound($Array) MINUS 1 instead of PLUS 1


Who else would I be?

Share this post


Link to post
Share on other sites

Thanks for the help. It turns out it was the Ubound() causing the problem because I did +1 instead of -1...*whoops*

Thanks again to the both of you :)

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