Oferv
13 years agoSuper Contributor
Ho to get WPF submenu item state
Hi,
can someone please let me know how to get a WPF submenu object's state.i tried to use the two following options.none is working:
1.
Log["AppendFolder"]("Reset project")
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["WaitAliasChild"]("Menu",5000)
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["Menu"]["WPFMenu"]["Click"]("File");
//Moves the mouse cursor to the menu item specified and then simulates a single click.
if(Aliases["FusionDesktop"]["WPFObject"]("HwndSource: PopupRoot", "")["WPFObject"]("PopupRoot", "", 1)["WPFObject"]("Decorator", "", 1)["WPFObject"]("NonLogicalAdornerDecorator", "", 1)["WPFObject"]("MenuItem", "_Reset Project", 4)["Enabled"] == "False")
{
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["WaitAliasChild"]("Menu",5000)
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["Menu"]["WPFMenu"]["Click"]("File|Reset Project");
}
else
LoadProject["Open_Project"]()
ResetProject()
Log["PopLogFolder"]()
}
2.
var FusionDesktop, Window, MainMenu, Submenu, Item;
// Obtains the Windows Notepad main menu
FusionDesktop = Sys["Process"]("FusionDesktop");
Window = FusionDesktop["Window"]("gDoc Fusion", "*");
MainMenu = Window["MainMenu"];
// Obtains the View submenu
Submenu = MainMenu["Items"]("File")["SubMenu"];
// Obtains the "Status Bar" menu item
Item = Submenu["Items"]("Reset project");
// Checks whether the item is enabled
if (Item["Enabled"])
Log["Message"]("The Status Bar menu item is enabled");
else
Log["Message"]("The Status Bar menu item is disabled");
i'll be happy if someone can help me solve that out.
Thanks
can someone please let me know how to get a WPF submenu object's state.i tried to use the two following options.none is working:
1.
Log["AppendFolder"]("Reset project")
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["WaitAliasChild"]("Menu",5000)
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["Menu"]["WPFMenu"]["Click"]("File");
//Moves the mouse cursor to the menu item specified and then simulates a single click.
if(Aliases["FusionDesktop"]["WPFObject"]("HwndSource: PopupRoot", "")["WPFObject"]("PopupRoot", "", 1)["WPFObject"]("Decorator", "", 1)["WPFObject"]("NonLogicalAdornerDecorator", "", 1)["WPFObject"]("MenuItem", "_Reset Project", 4)["Enabled"] == "False")
{
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["WaitAliasChild"]("Menu",5000)
Aliases["FusionDesktop"]["HwndSource_MainWindow"]["MainWindow"]["Grid"]["TabControl"]["Grid"]["DockPanel"]["Menu"]["WPFMenu"]["Click"]("File|Reset Project");
}
else
LoadProject["Open_Project"]()
ResetProject()
Log["PopLogFolder"]()
}
2.
var FusionDesktop, Window, MainMenu, Submenu, Item;
// Obtains the Windows Notepad main menu
FusionDesktop = Sys["Process"]("FusionDesktop");
Window = FusionDesktop["Window"]("gDoc Fusion", "*");
MainMenu = Window["MainMenu"];
// Obtains the View submenu
Submenu = MainMenu["Items"]("File")["SubMenu"];
// Obtains the "Status Bar" menu item
Item = Submenu["Items"]("Reset project");
// Checks whether the item is enabled
if (Item["Enabled"])
Log["Message"]("The Status Bar menu item is enabled");
else
Log["Message"]("The Status Bar menu item is disabled");
i'll be happy if someone can help me solve that out.
Thanks