Conditions within a hotstring

Get help with using AutoHotkey and its commands and hotkeys
Posts: 1
Joined: 14 Jun 2018, 08:07

Conditions within a hotstring

14 Jun 2018, 08:18

Hey, all,

I am having a bit of an issue, and was hoping you could help me out.

Here's the code I currently have:

Code: Select all

if WinActive("ahk_class OpusApp") or WinActive("ahk_class rctrl_renwnd32") or WinActive("ahk_class ApplicationFrameWindow") {
Send, ^itest^i
} Else if WinActive("App - test") {
Send, _test_
} Else {
Send, test
It works just fine in the window I expect it to. The only issue is that unlike the regular hotstring this one does not keep the ending character. So, for example, if I press Space at the end of the hotstring, the appropriate result is typed, but without the ending space.

Is this by design, or am I missing something? I could put a * in the hotstring definition, but then it just triggers where I don't need it, making it fairly useless.
User avatar
Posts: 1655
Joined: 30 Sep 2013, 06:48

Re: Conditions within a hotstring

14 Jun 2018, 10:04

This is by design for non-auto-replace hotstrings. But you can do this:

Code: Select all

Send, test%A_endchar%
This will work for most end characters.

Or, you could use context-sensitive hotstrings and auto-replace:

Code: Select all

#If WinActive("ahk_exe firefox.exe") 
#If					; ends context-sensitivity

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Elgin, Helgef, Marcosa1020 and 44 guests