2
votes

Again, I am new to the Autohotkey section, a problem I face right now. Ok, let me explain some on this as below.

a::
  loop
  {
    ; do something
    break
  }
  Send,{b}
return

b::
  ; do something
  Send,{a}
return

When "a" pressed, it is fined to call "b" activity, but after that, inside "b" it couldn't call "a" again. Why?

3
Prefix both key labels with $ like $a:: and $b::wOxxOm
Prefix $ will only make me can't even call another hotkey function.. i want to keep calling each other when the hotkey is send within the function..NewBieS
$a:: Send,{y} Sleep,100 Send,{b} return $b:: Send,{x} Sleep,100 Send,{a} return this only bring me to send yb when "a" pressed and send xa when "b" pressed...NewBieS
Don't use {} to send a letter key, just send a. Also try all methods: sendplay or sendEvent or sendInputwOxxOm
I don't know the answer to your question, but you could also add a label to both hotkeys each, and use gosub or goto (doesn't matter which one in your case, since there is a return after it anyways) INSTEAD of sendphil294

3 Answers

1
votes

Use GoSub. Example:

!z::
    MsgBox, z
return

F10::
    Gosub, !z
return
0
votes

With the newest Autohotkey Release (v1.1.22.09) following code creates a infinite loop calling itself:

a::
  loop
  {
    MsgBox % "A Hotkey"
    break
  }
  Send b
return

b::
  MsgBox % "B Hotkey"
  Send a
return

I assume you stripped out the "do something" code, where the real problem is located.

0
votes

You can do it with label.

test: a:: loop { ; do something break } Send,{b} return

b:: ; do something goto, test return