Jump to content

Recommended Posts

Posted

hi,

I need to select an item from sub menu, but it contains more than one that match.

E.g. supposed my menu is like

File->

Open New File

Open

I 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 File

is there a way to force AutoIt to select the exact sub memu I need?

many thanks,

Tomer.

Posted

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 Gude
How 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

Posted (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.aspx

Or 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, experiment

I didnt use this approach but i would go this route myself

edit: Here is what i get when i click an item and spy for this with spy++ it gives me command id

Posted Image

After you get this id you could try

ControlCommand($appofyours, "", "putcontrolofmenuhere", "SendCommandID", "putcommandidhere eg 35005")

Edited by Aktonius
Posted

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.

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
×
×
  • Create New...