Page 1 of 1

How to get an ampersand in the tray's tooltip

Posted: 21 Oct 2016, 13:42
by JoeWinograd
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

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

Posted: 21 Oct 2016, 13:49
by drawback
TrayTip:="a&&&b"

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

Posted: 21 Oct 2016, 14:08
by JoeWinograd
Sure enough! Thanks much!

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

Posted: 22 Oct 2016, 01:17
by lexikos
There's an explanation on StackOverflow: http://stackoverflow.com/a/10276283/894589

(AutoHotkey's ToolTip command uses TTS_NOPREFIX, so ampersands work there.)

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

Posted: 22 Oct 2016, 09:21
by JoeWinograd
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!

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

Posted: 22 Oct 2016, 17:18
by lexikos
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...

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

Posted: 24 Oct 2016, 01:43
by JoeWinograd
I think it would have made much more sense to replace a&b with ab and leave a&&b as is
Agreed!