Henry Pham
Henry Pham

Reputation: 2507

Prevent Autohotkey multiple evaluation

I have the following Autohotkey script:

^d:: ^l
^l:: ^g

My intention is to have 2 keymaps: Ctrl+D -> Ctrl+L and Ctrl+L -> Ctrl+G; but when I run the script, Ctrl+D is not map to Ctrl+L but will be map to Ctrl+G as autohotkey evaluate Ctrl+D -> Ctrl+L -> Ctrl+G.

Is there any way to prevent Autohotkey from evaluating the keymap multiple time?

Upvotes: 1

Views: 222

Answers (1)

Robert Ilbrink
Robert Ilbrink

Reputation: 7953

Your scripts call each other, which is a common problem in AutoHotKey. To prevent this from happening, you have to add a $ in front of the hotkey that you don't want to be launched by ahk

^d:: ^l ; This script will trigger the next one
$^l:: ^g ; The $ sign prevents that another AutoHotKey script can launch this.

Upvotes: 1

Related Questions