/[TestComplete JScript]============================== // Function: SelectMainMenu // Description: selects a menu item from Infragistic Main menu // Parameters: // -pProcess - process of the application // -oMenu - main menu, object // -sMenuItem - menu item to select, string // Return: <none> // NOTES: menu items should be splitted with "|" symbol, e.g. "File|Options", "Administration|Edit|Account Roles" function SelectMainMenu(pProcess, oMenu, sMenuItem) { var aMenu = sMenuItem.split("|"); var i, j; // counter var iX = 0, iY = 0; // coordinates for clicking var iCount; // menu items count for each toolbar/popup menu var obj; // temporary object for different menuitems var iLevels = aMenu.length-1; // * * * Selecting top level menu item... iCount = oMenu.ToolbarsManager.Toolbars.Item(0).Tools.Count; // number of menu items in main menu for(i = 0; i < iCount; i++) { obj = oMenu.ToolbarsManager.Toolbars.Item(0).Tools.Item(i); Log.Message("Checking menu '" + obj.CaptionResolved.OleValue + "'"); if(obj.CaptionResolved.OleValue.match(aMenu[0])) { oMenu.Click(iX + obj.WidthResolved/2, iY + obj.Height/2); break; } else { iX += obj.WidthResolved*obj.VisibleResolved; } } // * * * After top level menu selected selecting other menus... //for(j = iLevels; j > 0; j--) for(j = 1; j <= iLevels; j++) { iX = 0; iY = 0; obj = pProcess.WinFormsObject("DropDownForm", "", 1).WinFormsObject("PopupMenuControlTrusted", ""); iCount = obj.MenuAgent.MenuItems.Count; for(i = 0; i < iCount; i++) { Log.Message("Checking menu item '" + obj.MenuAgent.MenuItems.Item(i).Text.OleValue + "'"); if(StrTran (obj.MenuAgent.MenuItems.Item(i).Text.OleValue, "&", "").match(aMenu[j])) { obj.Click(iX + 10, iY + 10); break; } else { iY += 25; } } } // j= iLevels... }
Monday, December 19, 2011
Select custom button in SwfToolbar
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment