1

How to mask ":" in a first row in AutoHotKey Hotstring? I want to type "colors:" and get "red, violet, blue".

::colors':::
Send, 
(
red, violet, blue
)
return
1

: is an ending character by default. You only have to define

::colors':: ; or/and  
::colors::
Send, 
(
red, violet, blue
)
return

and press : after typing colors' or colors.

| improve this answer | |
  • That answers my question only partly. I realized that when I type "colors:", I get the desired result somehow. But I also get two unnecessary shortcuts I lean to avoid: "colors" and "colors'". – Kosarar Jan 1 '19 at 17:27
  • Then use another character instead of :, e.g. / or <. – user3419297 Jan 2 '19 at 13:11
  • Yes, it works. Well, close enough, I guess. :D – Kosarar Jan 3 '19 at 13:45
1

You can use the Hotstring() function if you want the trigger string to end with a colon:

Hotstring("::colors:", "red, violet, blue")

Then, when you type "colors:" + Space, you get the text "red, violet, blue " – notice the trailing space. If you don't want the trailing space, you can for example change the trigger string to :O:colors:. Consult the Hotstrings documentation for more options.


If your AHK script also contains hotstrings that are defined with a double-colon label (e.g. ::foo::bar), they must be defined after defining hotstrings using the Hotstring() function:

; WRONG - the second hotstring won't work
::shapes::triangle, circle, rectangle
Hotstring("::colors:", "red, violet, blue")
; CORRECT
Hotstring("::colors:", "red, violet, blue")
::shapes::triangle, circle, rectangle

This is because the first hotstring label (or the first return, exit or hotkey label) in the script ends the script's auto-execute section. So, the Hotstring() function never gets called if it's outside of the auto-execute section.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.