Jump to content
Sign in to follow this  
SkellySoul

For...Next...Exits

Recommended Posts

SkellySoul

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
this-is-me

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
SkellySoul

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.