How to get an ampersand in the tray's tooltip

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
JoeWinograd
Posts: 2203
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

How to get an ampersand in the tray's tooltip

21 Oct 2016, 13:42

I'm trying to get an ampersand to appear in the tray's tooltip. Here's my simple testing script:

Code: Select all

TrayTip:="a<trying to get an ampersand>b"
Menu,Tray,Tip,%TrayTip%
msgbox bye
exitapp
I have tried these:

TrayTip:="a&b" — result is ab
TrayTip:="a&&b" — result is ab
TrayTip:="a`&b" — result is ab
TrayTip:="a^&b" — result is a^b
TrayTip:="a{&}b" — result is a{}b

I'm fresh out of ideas for the esacpe character(s). Thanks, Joe
User avatar
JoeWinograd
Posts: 2203
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: How to get an ampersand in the tray's tooltip

21 Oct 2016, 14:08

Sure enough! Thanks much!
lexikos
Posts: 9621
Joined: 30 Sep 2013, 04:07
Contact:

Re: How to get an ampersand in the tray's tooltip

22 Oct 2016, 01:17

There's an explanation on StackOverflow: http://stackoverflow.com/a/10276283/894589

(AutoHotkey's ToolTip command uses TTS_NOPREFIX, so ampersands work there.)
User avatar
JoeWinograd
Posts: 2203
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: How to get an ampersand in the tray's tooltip

22 Oct 2016, 09:21

Ah, that explains it nicely! I had a sense it was menu-related when "a&&b" resulted in "ab", but didn't understand why until that comment. Thanks!
lexikos
Posts: 9621
Joined: 30 Sep 2013, 04:07
Contact:

Re: How to get an ampersand in the tray's tooltip

22 Oct 2016, 17:18

I think there's a further bit of explanation missing: the person who designed it didn't know what they were doing. ;)

Personally, I think it would have made much more sense to replace a&b with ab and leave a&&b as is - i.e. remove the underline but otherwise leave the final display text as is. With the current behaviour, I suppose a menu item a && b which displays as "a & b" would display as "a b" in a tooltip, which would obviously be incorrect.

Stripping the first & regardless of what follows it would make sense if the tooltip used TTS_NOPREFIX, since that would convert a&&b to a&b, which would then display correctly. But the system doesn't strip any ampersands if you use TTS_NOPREFIX...
User avatar
JoeWinograd
Posts: 2203
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: How to get an ampersand in the tray's tooltip

24 Oct 2016, 01:43

I think it would have made much more sense to replace a&b with ab and leave a&&b as is
Agreed!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 164 guests