Sign in to follow this  
Followers 0
dao

'&' in Menu Item

9 posts in this topic

I have a menu item that uses an '&' in the actual menu text (in addition to an underlined character). Can someone tell me how to use the WinMenuSelectItem function with the two "flavours" of &?

Share this post


Link to post
Share on other sites



I have a menu item that uses an '&' in the actual menu text (in addition to an underlined character). Can someone tell me how to use the WinMenuSelectItem function with the two "flavours" of &?

I think I understand what you mean. If the menu item looks like this

fish & chips

then the actual text will be

&fish && chips


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I have a menu item that uses an '&' in the actual menu text (in addition to an underlined character). Can someone tell me how to use the WinMenuSelectItem function with the two "flavours" of &?

What application is it that has the menu like this? Is it something you've created with Autoit? Also it would be helpful if you typed out an example like this:

Notpad has File

To use WinMenuSelectItem() I would use WinMenuSelectItem("Untitled - ", "", "&File")

Now if your application has &Menu1 then the code might be the following. At least that's what would make sense to me. Without more information that's the best I can offer at this time.

WinMenuSelectItem(Title, Text, Chr(38) & "Menu&1")

Edit: You guys are just too fast for me! :) I would be interested to see if both methods work.

Edited by ssubirias3

Share this post


Link to post
Share on other sites

I tried the '&&' and the chr(38) and neither seemed to work.

(For a little background, the menu item is "Test & Copy")

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I tried the '&&' and the chr(38) and neither seemed to work.

(For a little background, the menu item is "Test & Copy")

So WinMenuSelectItem(Title, Text, "Test " & Chr(38) & "C&opy") doesn't work? Edited by ssubirias3

Share this post


Link to post
Share on other sites

That's correct... neither of the following worked:

WinMenuSelectItem("title", "text", "Test && C&opy")

WinMenuSelectItem("title", "text", "Test " & chr(38) & " C&opy")

Share this post


Link to post
Share on other sites

My apologies, the double ampserand (below) does work. I had an error in the another part of the indented menu structure.

WinMenuSelectItem("title", "text", "Test && C&opy")

Thanks all for your help!

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

That's correct... neither of the following worked:

WinMenuSelectItem("title", "text", "Test && C&opy")

WinMenuSelectItem("title", "text", "Test " & chr(38) & " C&opy")

Well I've searched several of my applications and I can't find an example that uses "&" as part of the menu text. My initial guess is that this is poor software design since its pretty standard that the & means something in Windows menu commands. The other thing to note is that I personally have found WinMenuSelectItem() a bit buggy. You can search the forum for "WinMenuSelectItem()" for a few of my posts including a feature request.

Probably the best alternative is to use ControlSend() or ControlClick() until enough people agree this is a problem and the dev team does something to fix it. If you feel passionate about it, you can always add your 2 cents on this tread.

Edit: good job getting it working. Both martin and Zedna are some of the best you'll find here.

Edited by ssubirias3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0