Super-ilad
Super-ilad

Reputation: 101

How to instantly detect the key input in AHK?

i am new to AHK.

Here is a example , i have to press "hello" and then press a "space key" so that i can generate a "hello world" string

then,is there any way to skip that "space key" press?

that is , every time i input a "hello" , AHK would be able to instantly generate the string i want ,rather than waiting for a spare key press to response.

i have searched for specific solutions online , but either the example are too complicated to a freshman or the solution is vague, i know this question easy but a little obscure

::hello::hello world   
return

Thanks if you can have a brief solution for me !

Upvotes: 0

Views: 821

Answers (2)

Super-ilad
Super-ilad

Reputation: 101

Here is a standard official intro part of asterisk method to this problem:

(asterisk) *: An ending character (e.g. Space, ., or Enter) is not required to trigger the hotstring. For example:

:*:j@::[email protected]

The example above would send its replacement the moment you type the @ character. When using the #Hotstring directive, use *0 to turn this option back off.

That is , if you want to instantly generate a string using hotstring, you can add :*: in front of you code

::hello::hello world 

after add that prefix :*::

:*:hello::hello world

we can directly call string without pressing extra key like "space bar".

Upvotes: 0

Lixfeld
Lixfeld

Reputation: 253

If you don't want to type an ending character after a hotstring (like space), you need to use the "asterisk option". Hotstring Options

Example: :*:hello::hello world

Upvotes: 2

Related Questions