I have 5 different variables labled Navigation1,Navigation2,Navigation3, etc. Within them are user assigned hotkeys. What this snippet of code is supposed to do is search for if they have the words "JoyPOV", and if so to not assign it to a hotkey (In my example below I made it a msgbox for now).
The problem I am having is that the "else" section is still assigning the button to a key even if it contains the words "JoyPOV". What is wrong with this loop?
Thanks!
loop 5
{
IfInString, Navigation%A_index%, JoyPOV
{
msgbox, Navigation%A_index%
}
else
IfNotInString, Navigation%A_index%, JoyPOV
{
if %A_index% := 1
PauseButton = %Navigation1%
Hotkey, ~%PauseButton%, PauseKey
if %A_index% := 2
UpButton = %Navigation2%
}
}
What is wrong with my loop?
Re: What is wrong with my loop?
if %A_index% := 1 is an assignment AND a comparison (:= is assignment), and as such is always true
Your code is also inefficient. When you check if A_Index is 1, you should use an ELSE IF to check if it is 2, else even if it is 1, you still check if it is 2
Your code is also inefficient. When you check if A_Index is 1, you should use an ELSE IF to check if it is 2, else even if it is 1, you still check if it is 2
Code: Select all
if (A_Index == 1){
} else if (A_Index == 2){
}
Who is online
Users browsing this forum: Google [Bot], Joey5, Londolozi, ShatterCoder and 109 guests