2
votes

I am trying to make a simple script that writes short statements for me when I use a hotkey such as ^B or ^T. The issue is that when it is typing itself, it will activate another hotkey that then starts straight after it so I am left with a double sentence.

^b::
hello, I am AutoHotKey.

^t::
What can I do for you?

In the above example, the "AutoHotKey" will trigger the second script because of the "t" in it and the fact that it goes faster than the input that the control key is no longer held down.

Is there a way to make one function exclusive so it cannot trigger other functions or will I have to have completely different hotkeys?

1
That is not valid code, how did you run that? - this
Once you assign those keys, they will be global - so when you run the script, they will "take over" any other hotkeys that already exist on your system. However, when you launch a new program that uses those hotkeys, that program might usurp your existing commands. You could fix that by making your script re-run itself when it detects a certain window. - bgmCoder
@TGSpike probably meant ^b::hello, I am AutoHotKey. (without linebreak) or Send, hello, I am AutoHotKey. in the second line. 3&4 analogous. - Cadoiz

1 Answers

7
votes

If you put a $ before the hotkey, it is only activated if pressed

$^b::
Send, hello, I am AutoHotKey.
return

$^t::
Send, What can I do for you?
return