Preventing hotstrings from getting triggered by ".". Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kotte
Posts: 46
Joined: 03 May 2021, 08:33

Preventing hotstrings from getting triggered by ".".

Post by Kotte » 18 Jan 2022, 11:58

Hi! I'm having trouble with my hotstring script. I'm trying to prevent hotstrings from getting triggered if they are part of a string, but I'm not making any progress. I thought that setting #Hotstring Endchars to Space would solve it, but all kinds of keypresses still triggers it. One example would be:

Code: Select all

#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance,Force
#Hotstring EndChars ; Only SPACE triggers hotstrings

::ahk::autohotkey
I would like these types of hotstrings to be triggered only by typing ahk and hitting space, but I can't get it to work. It triggers if I type .ahk, ahk. and a bunch of other keys. I have tried several combination of the hotstring options without luck. I also tried adding

Code: Select all

::.ahk::
::ahk.::
, but it didn't work. Is there a solution for this or would I have to change my approach? I know that changing all such hotstrings to be

Code: Select all

:C:Ahk::autohotkey
would solve it, but I was hoping that someone knew of another solution.

User avatar
mikeyww
Posts: 26595
Joined: 09 Sep 2014, 18:38

Re: Preventing hotstrings from getting triggered by ".".  Topic is solved

Post by mikeyww » 18 Jan 2022, 12:17

Code: Select all

#Hotstring EndChars  }
:CB0:.ahk::
:C:ahk::AutoHotkey

Kotte
Posts: 46
Joined: 03 May 2021, 08:33

Re: Preventing hotstrings from getting triggered by ".".

Post by Kotte » 19 Jan 2022, 04:42

mikeyww
You're the man, Mikey! Haha, I was pretty close to solving it, it seems. I had this commented out in my code

Code: Select all

:B0C?Z:.ahk::
#Hotstring EndChars "
, but it only solved half the problem. Thanks for the help!

Post Reply

Return to “Ask for Help (v1)”