Forum Discussion
karkadil
12 years agoValued Contributor
Each menu item has SubMenu property which is empty (null) when menu item doesn't have submenu. For example, the following code will print to the log information about each menu item of the Notepad Main Menu.
var wnd = Sys.Process("NOTEPAD").Window("Notepad", "Untitled - Notepad");
for(var i = 0; i < wnd.MainMenu.Count; i++)
{
var caption = wnd.MainMenu.Items(i).Caption;
if(wnd.MainMenu.Items(i).SubMenu == null)
{
Log.Message(caption + " menu doesn't have submenu");
}
else
{
Log.Message(caption + " menu has submenu");
}
var wnd = Sys.Process("NOTEPAD").Window("Notepad", "Untitled - Notepad");
for(var i = 0; i < wnd.MainMenu.Count; i++)
{
var caption = wnd.MainMenu.Items(i).Caption;
if(wnd.MainMenu.Items(i).SubMenu == null)
{
Log.Message(caption + " menu doesn't have submenu");
}
else
{
Log.Message(caption + " menu has submenu");
}
Related Content
- 13 years ago
- 2 years ago
- 9 years ago
Recent Discussions
- 24 hours ago