Reputation: 514
I wish to create a hotstring "@@" for my email address, and another "@@@" for my full postal address. I have created a script that works when the third hotstring character differs from the second, but can't get it to work for my preferred "@@@" hotstring.
My working example uses "@@" for the email, and "@@1" for address, where the "1" needs to be entered within 0.7 seconds of entering "@@":
:*:@@::
keywait 1, D T 0.7
if errorlevel = 1
{
send {backspace}[email protected]
}
else
Send, {backspace}Mr.Benn, 52 Festive Road, London
return
Upvotes: 0
Views: 244
Reputation: 331
Something to bear in mind is that the asterisk in the first set of colons means to not wait for an end character, like space or return to fire (see docs https://www.autohotkey.com/docs/Hotstrings.htm for full list).
A more elegant solution might be something like:
::@@::[email protected]
:*:@@@::Mr Random, 123 Some St, Anytown, 012345
I personally prefer using a prefix character in my hotstrings like "*" when sending a full string and not just a typo fix. Example:
:*:*tysm::thank you so much
In my decade of experience with AHK this prevents accidentally creating a hotstring that replaces something you didn't think about on initially writing the script (something always gets forgotten).
Upvotes: 1
Reputation: 514
I still have to work out why this answer works, but it appears to work as wished for:
:*:@@::
keywait @, U T 0.7
keywait @, D T 0.7
if errorlevel = 1
{
send {backspace}[email protected]
}
else
Send, {backspace}Mr.Benn, 52 Festive Road, London
return
Upvotes: 0