Hi,
I'm just using AutoHotKey right now, for text expansion. I searched google for 'autohotkey single trigger key' and similar searches, but cannot find the answer to this.
I want to use ONLY the <tab> key to trigger a text expansion.
So if I have wt defined thus:
::wt::What the...?
, I'd want to type
wt <tab>, and ahk will return the full text expansion.
But if I type wt <ENTER> or wt <space> or wat <period(.)>, I want ahk to do NOTHING.
How do we restrict the trigger key, to ONLY the <tab> key?
Also, how do we put a carriage return/line feed into the text expansion? So if we want for 'wt' to represent
what
the
heck
is
going
on
?
, how to we move each word to the next line?
Thanks,
How do you set just a Tab key, to trigger a text expansion?
-
- Posts: 20
- Joined: 19 May 2019, 17:04
Re: How do you set just a Tab key, to trigger a text expansion?
You can set the allowed end characters for all hotstrings of a script with the #Hotstring directive: https://www.autohotkey.com/docs/Hotstrings.htm#EndChars
For special characters like tab, you will need the corresponding escape sequence, in this case `t
Code: Select all
#Hotstring EndChars `t
:o:wt::What the...?
You can use a continuation sectionAHKExplorer wrote: ↑19 May 2019, 17:10Also, how do we put a carriage return/line feed into the text expansion? So if we want for 'wt' to represent
Code: Select all
:o:wt2::
(
what
the
heck
is
going
on
?
)
Code: Select all
:o:wt3::what`nthe`nheck`nis`ngoing`non`n?
-
- Posts: 20
- Joined: 19 May 2019, 17:04
Re: How do you set just a Tab key, to trigger a text expansion?
Thanks, Gregster. I'm surprised that it's necessary to specify the tab character in order to exclude the others, since those trigger characters are automatic. I guess I was expecting an EXCLUDE section for characters you don't want.
In other words, if the entire ahk code is
::hw::Hello World
::wt::What the...?
, the default trigger will be <tab>, period, space, <enter> and maybe some others.
Anyway, that's neither here nor there. If the #Hotstring directive does the trick, that's good enough.
Thanks for all the samples to start with, that's perfect.
Regards,
In other words, if the entire ahk code is
::hw::Hello World
::wt::What the...?
, the default trigger will be <tab>, period, space, <enter> and maybe some others.
Anyway, that's neither here nor there. If the #Hotstring directive does the trick, that's good enough.
Thanks for all the samples to start with, that's perfect.
Regards,
Re: How do you set just a Tab key, to trigger a text expansion?
Right, there is no exclude option available for this.
https://autohotkey.com/docs/Hotstrings.htm#EndChars wrote:Ending characters initially consist of the following: -()[]{}':;"/\,.?!`n `t (note that `n is Enter, `t is Tab, and there is a plain space between `n and `t).
-
- Posts: 20
- Joined: 19 May 2019, 17:04
Re: How do you set just a Tab key, to trigger a text expansion?
There's also the * option:
Hotstrings - Definition & Usage | AutoHotkey
https://autohotkey.com/docs/Hotstrings.htm#Options
Hotstrings - Definition & Usage | AutoHotkey
https://autohotkey.com/docs/Hotstrings.htm#Options
Two examples:* (asterisk): An ending character (e.g. Space, ., or Enter) is not required to trigger the hotstring.
Code: Select all
:*:wt`t::What the...?
:*:wt2`t::
(
what
the
heck
is
going
on
?
)
*/
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