Conditions within a hotstring

Get help with using AutoHotkey and its commands and hotkeys
yacoUxRsVQvUHgVeGhLX
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] [Download] GeSHi © Codebox Plus

::tst::
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
gregster
Posts: 1184
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:

This will work for most end characters.

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

Code: [Select all] [Download] GeSHi © Codebox Plus

#If WinActive("ahk_exe firefox.exe") 
::tst::_test_
#If ; ends context-sensitivity
::tst::test

Return to “Ask For Help”

Who is online

Users browsing this forum: imustbeamoron, jonjbm, tmplinshi and 8 guests