public void Click(string itemText) { MsoCommandBarItemPopup target = null; foreach (MsoCommandBarItemPopup item in ItemList) { if (item != null && item.Name.Equals(itemText)) { target = item; break; } } if (target != null) { target.Click(); } }
private void InitToolBar() { if (this.WindowHandle != null) { CurAccessibile = new SUIAccessibility(WindowHandle, AccType.NativeOM); int count = CurAccessibile.ChildCount; itemList = new MsoCommandBarItemPopup[count]; int index = 0; for (int i = 1; i <= count; i++) { if (CurAccessibile.Children[i].IsVisible || CurAccessibile.Children[i].Height > 0)//Judge whether it is visible not only by property IsVisible but also Height { itemList[index] = new MsoCommandBarItemPopup(CurAccessibile.Children[i]); index++; } } } }
public SUIMsoCommandBarPopup PopupSubMenu(string itemText) { MsoCommandBarItemPopup target = null; foreach (MsoCommandBarItemPopup item in ItemList) { if (item != null && item.Name.Equals(itemText)) { target = item; break; } } if (target != null) { target.Click(); SUISleeper.Sleep(500); SUIWinAPIs.EnumWindows(new EnumSMARTUIWindowsProc(this.FindPopupMenu), 0); return(popupedMenu); } return(null); }