Hotstring() function with label or function vs Ending character

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Hotstring() function with label or function vs Ending character

11 May 2018, 15:10

Not sure if this is the desired behavior or if this should be considered as a bug.

When you type an hotstring trigger with default options, the ending character is kept after the hostring is expanded. For example, with the code below, type "btw" and Enter and the expanded "by the way" string will be followed by a new line. Type "btw" and Space and the expanded "by the way" string will be followed by a space.

But if you use the new Hotstring() function with the same default options, the ending character is not kept. It is as if the "O" (Omit the ending character) option was used. But it is not. Same behavior when using a function instead of a label.

Is it a known limitation of the Hotstring() function or a bug?

Thanks.

Code: Select all

Hotstring(":X:asap", "TypeASAP", On)
return

::btw::
send, by the way
return

TypeASAP:
send, as soon as possible
return
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Hotstring() function with label or function vs Ending character

11 May 2018, 15:34

what?

in the example u provided, typing 'btw' followed by space or enter will not result in 'by the way' + \n or \s. youre using send to type the characters, the hotstring flags have no bearing upon what Send does.
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Hotstring() function with label or function vs Ending character

11 May 2018, 15:58

Oh ;-) I first tested it with the format ::btw::by the way then changed last minute to using Send. (never do :-\ )

So it is not using the Hotstring() function with a Label or a Function that cause this but the use of Send. I see...

This was awkward, but it replied my question :-)
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Hotstring() function with label or function vs Ending character

11 May 2018, 15:58

And thanks, swagfag.
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: Hotstring() function with label or function vs Ending character

12 May 2018, 18:17

It is not the use of Send which causes this. If you don't send anything, you still won't get the ending character.

It is the difference between auto-replace hotstrings and other hotstrings. Auto-replace hotstrings send the replacement text and end character. Non-auto-replace hotstrings only perform backspacing by default.
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Hotstring() function with label or function vs Ending character

12 May 2018, 22:17

Thanks Lexikos for the precision. Would you consider in a future release to add the "Keep ending character" options for "other hotstrings" (those non-auto-replace)?
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: Hotstring() function with label or function vs Ending character

14 May 2018, 17:20

What would you expect the option to do? What if the hotstring doesn't call Send at all, or calls Send multiple times?

If you don't want to erase the hotstring abbreviation and end character, use B0. If you want just the end character to remain, or you want it to appear after text you send, send the contents of A_EndChar.
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Hotstring() function with label or function vs Ending character

14 May 2018, 17:31

Ah! Good. The solution is already available: sending A_EndChar.

Thanks.
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 202 guests