Pharco wrote:
I think I tried every possible combination of "return" in my script and it never worked
Gogo's script is fundamentally different than the script you posted.
The difference is the use of multiple threads
http://www.autohotkey.com/docs/misc/Threads.htm
Here's an analogy to hopefully explain:
In your script, you have one "worker"
doing every thing sequentially
There is no chance for the worker to "send {b 1}" because the while loop (and everything in between) won't allow for it.
If you have wanted to send a & b at the same time, they could have been in the same loop. But that isn't what you wanted.
In Gogo's script, there is a supervisor with two employees.
These two employees are special and are controlled by "SetTimer" instructions.
One of them is told "sleep, 5000" and "send a" and repeat ... forever
Meanwhile, the supervisor waits for the "g" key to release.
When the key is is released, the supervisor says, "finish your sleep, and your send, and then stop what you are doing".
This is a reasonably correct analogy. It is not perfect, because AHk is not multi-threaded.
The 3 workers are actually played by just one "actor" who keeps switching between the jobs.