How to launch an app from the start menu

Sep 13, 2010 at 2:35 PM

Hello, Is there a way we can launch the application from the start menu. going to START/PROGRAM... or by clicking on the shortcut icon? Thanks.

 

Sep 13, 2010 at 3:04 PM

Hi

Desktop.Instance.Get....

this is the way to get elements on the desktop which are not directly assigned to an application.

Note: the way is different from OS to OS (XP uses other controls as Win7)

maybe the benefit to automate this is very low but the effort high.

 

Throndorin

 

 

 

Sep 13, 2010 at 5:37 PM

Thanks, Actually I did find from the discussion how to launch the app from the start menu. it works fine however after the application is launched, when i use GetWindow to get the main window,  I get Visual; studio debugger. Can some one help me?

   Desktop desktop = Desktop.Instance;
            // For some reason it's not sufficient to just give a string argument to Get below, it has to be a search criterion
            desktop.Get<Button>(SearchCriteria.ByText("start")).Click();

            Panel startMenu = desktop.Get<Panel>(SearchCriteria.ByText("Start Menu"));
            Button b = startMenu.Get<Button>(SearchCriteria.ByText("All Programs"));
            Mouse.Instance.Location = b.ClickablePoint;
            Thread.Sleep(500);
            Point p = b.ClickablePoint;
            p.Offset(startMenu.Bounds.Width * 0.6, 0);
            Mouse.Instance.Location = p;

            Panel sm = desktop.Get<Panel>(SearchCriteria.ByAutomationId("StartMenu"));
            Menu menu = sm.Get<Menu>(SearchCriteria.ByText("MyApp"));
            Mouse.Instance.Location = menu.ClickablePoint;
            Thread.Sleep(500);
            p = menu.ClickablePoint;
            p.Offset(sm.Bounds.Width * 0.6, 0);
            Mouse.Instance.Location = p;

            // From here on, execution takes a minute or two per mouse movement
            Panel sm2 = desktop.Get<Panel>(SearchCriteria.ByAutomationId("StartMenu").AndIndex(1));
            Menu menu2 = sm2.Get<Menu>(SearchCriteria.ByText("TestApp");
            Mouse.Instance.Location = menu2.ClickablePoint;
            Mouse.Instance.Click ();
     

//to get the main window

White.Core.UIItems.WindowItems Window MainWindow = Test App.GetWindow("TestApp", IntiitalizeOption.Nocache);

I am not sure what is causing this to happen. can someone please help? Thanks.

 

Sep 14, 2010 at 2:16 PM

does any one know why I get the exception when getting the window after launching the test app from the  START menu . ?

White.Core.UIItems.WindowItems Window MainWindow = Test App.GetWindow("TestApp", IntiitalizeOption.Nocache);

 

Thanks in advance.

Sep 15, 2010 at 5:14 PM

This is resolver by using App = Applicaton.Attach processess before activating the main window. Thanks.