tomers Posted February 22, 2012 Share Posted February 22, 2012 hi,I need to select an item from sub menu, but it contains more than one that match.E.g. supposed my menu is likeFile-> Open New File OpenI need to call "File->Open", so I'm using the command:WinMenuSelectItem(MyMainWindow, "", "File", "Open")but it seems that the system is searching the first match for File->Open.* so the first one is File->Open New Fileis there a way to force AutoIt to select the exact sub memu I need?many thanks,Tomer. Link to comment Share on other sites More sharing options...
BrewManNH Posted February 22, 2012 Share Posted February 22, 2012 Does the menu command have any of the characters underlined when you open the menu with the ALT key? Because "&Open" is different than "Open &New File" where the "&" is what letter that is underlined when you do this. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
tomers Posted February 22, 2012 Author Share Posted February 22, 2012 thanks for the reply, but No.I'm aware of the use of &, and above is just an example:Main menu is FileSub menu 1 is Open New FileSub menu 2 is Openthe question is how to execute File->Open?I have noticed that there is an option of calling menu command by its location, but it does not work for me.http://www.autohotkey.com/docs/commands/WinMenuSelectItem.htmthanks,Tomer. Link to comment Share on other sites More sharing options...
Aktonius Posted February 22, 2012 Share Posted February 22, 2012 (edited) tomers you should try sending wm_command message with sendmessage() because this is the message you send to the app when you click on those menu items. And everytime you do this you send different message depending what you click.http://msdn.microsoft.com/en-us/library/windows/desktop/ms647591%28v=vs.85%29.aspxOr you could try something like controlcommand() and use "SendCommandID", Command ID Simulates the WM_COMMAND message. Usually used for ToolbarWindow32 controls - use the ToolBar tab of Au3Info to get the Command ID. You could also use a tool like spy++ to inspect wm_command message for the desired app, then only filter this message, manually click some menu items to see sendmessage params, test, experimentI didnt use this approach but i would go this route myselfedit: Here is what i get when i click an item and spy for this with spy++ it gives me command idAfter you get this id you could tryControlCommand($appofyours, "", "putcontrolofmenuhere", "SendCommandID", "putcommandidhere eg 35005") Edited February 22, 2012 by Aktonius Link to comment Share on other sites More sharing options...
tomers Posted February 22, 2012 Author Share Posted February 22, 2012 I don't think I can do that, because I cannot tell the menu item to be selected from the beginning, only in run time.doesn't AutoIt has a command to select a menu item by its location, similar to AutoHotKey?Regards,Tomer. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now