SendMenusTo

Activates a window and sends a specified menu option.

Syntax:

SendMenusTo(windowname, menuname)

Parameters:

(s) windowname the initial part of, or an entire parent window name.

(s) menuname windows message to be posted or performed.

Returns:

(i) always 0.

 

Use this function to access drop down menus on a window. The function activates the "windowname" application window, searches its menus and sends the specified windows message for the menu operation.

To construct the "menuname" parameter simply string together all the menu options selected to access the desired function. All punctuation and special characters are ignored, as well as any possible "hotkeys" used to access the function via the keyboard. For example, most Windows applications have a "File" menu and an "Open" menu. To construct the "menu name" parameter, simply string together the words, making "FileOpen", or for better readability use "File Open" - the spaces are ignored.

SendMenusTo attempts to wait until the specified application window is ready to accept input (like SendKey[..] does). This can be disabled with IntControl 43.

Note 1: "windowname" is the initial part of a window name, and may be a complete window name. It is case-sensitive. You should specify enough characters so that "windowname" matches only one existing window. If it matches more than one window, the most recently accessed window which it matches will be used.

Note 2: SendMenusTo does not work with all applications. If you get a 'windows menu not accessible' error, SendMenusTo will not work with that application. WinBatch does not support owner drawn menus. The reason for that is simple. The data associated with the menu item is application-defined instead of it being a text string. WinBatch has no way of knowing how to interpret the data. Use SendKeysTo instead.

Example:


DirChange(DirWindows(0))
Run("notepad.exe", "c:\config.sys")
SendMenusTo("~Notepad", "Edit Select All")
SendMenusTo("~Notepad", "Edit Copy")
See Also:

SendKeysTo, SendKeysChild, SendKey, SnapShot