Thanks both for your responses.
After posting, I played around more and realized i didn't call my function. but couldn't update my pending post
, when i did call the function it had the same behavior.
This example code is an abstract from a bigger function. There a lot going on before it decides so subtract one.
I could use a Loop and call the function with the original number if it shouldn't subtract one, but i couldn't find a way to prevent an infinite loop other than nest it in another Loop.
i settled for "While" with 2 conditions.
Great suggestion in using different variable names within the function and outside the function.
the problem the described issue causes is that when the function is done, its recalled with the original amount.
Changing the variable name in my function, I realize my initial code abstract doesn't exactly represent the code.
"Amount" is never used outside of the function.
Nice to see ahk supports --a and ++a. I'll use that too.
Still your suggestion is really helpful. It didn't point to some limitation within ahk, the limitation is my coding skills, not the language
something else popped up after moving my script to another machine. that needs fixing first (OCR not working on a new pc).
Thanks again, Sem