:*:`;::abc It works.
:*:`:::abc It does not works.
Mod edit: Added title
bug? Hotstring using just a colon
- Delta Pythagorean
- Posts: 628
- Joined: 13 Feb 2017, 13:44
- Location: Somewhere in the US
- Contact:
Re: bug?
For a single character hotstring, you can use a hotkey instead, like so:
Both work respective to what was pressed (individual key or shift modifier).
Code: Select all
:::
MsgBox, Colon
Return
`;::
MsgBox, SemiColon
Return
[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat
Re: bug?
You can use the hotstring function, hotstring(":*::", "abc").hotstrings wrote: Although commas, percent signs, and single-colons within hotstring definitions do not need to be escaped, backticks and those semicolons having a space or tab to their left require it.
Cheers.
Re: bug?
@helgef :\
I don't get it. I don't see what explains why
and
both fail. I see using the HOSTRING function as just a workaround.
I don't get it. I don't see what explains why
Code: Select all
:*:`::: this fails
Code: Select all
:*:::: this fails too
Re: bug?
Just FYI, by writing a function like this, you can define a hotstring anywhere in a script, versus being forced to define it in the auto-execute section.
Code: Select all
MyHotstring()
{
static vDummy := MyHotstring()
Hotstring(":*::", "abc")
}
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: bug?
@joefiesta, it means that the attempt to escape the single colon is futile. As for,
This has two possible interpretations, either it is a hotstring which is missing its abbreviation, with the replacement text : this fails too, or the abbreviation is a single colon with the replacement text this fails too. Clearly the first interpretation is made, although the second one is probably preferable. With the hotstring function there is no ambiguity (since the trailing :: are omitted).
@jeeswg,
Cheers.
Code: Select all
:*:::: this fails too
@jeeswg,
Code: Select all
MyHotstring()
{
static Dummy := Hotstring(":*::", "abc")
}
Re: bug?
In v2, you can escape a single colon, hence, :*:`:::abc is replacing a single : with abc. This cannot happen in v1, because in v1, the backtick (`) in :*:`:::abc is escaping the following double colon, see escape sequences. So in v1, you can do :*:`::::abc to have :: be replaced by abc, in v2 that will replace : with :abc.
Cheers.
Cheers.
Re: bug? Hotstring using just a colon
Thanks Helgef.
So, here are 2 examples, a one-liner and a multi-liner.
So, here are 2 examples, a one-liner and a multi-liner.
Code: Select all
MyHotstrings1()
{
static vDummy := Hotstring(":*::", "abc")
}
MyHotstrings2()
{
static vDummy := MyHotstrings2()
Hotkey, IfWinActive, ahk_class Notepad
Hotstring(":*:abc-", "Notepad")
Hotkey, IfWinActive, ahk_class WordPadClass
Hotstring(":*:abc-", "WordPad")
Hotkey, IfWinActive
Hotstring(":*:abc-", "other")
}
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Who is online
Users browsing this forum: No registered users and 1 guest