public static void Test() { Ldtp.Ldtp l = new Ldtp.Ldtp("*Notepad*"); l.WaitTillGuiExist(); l.SelectMenuItem("mnuFile;mnuNew"); }
static void Main(string[] args) { Ldtp.Ldtp ldtp = new Ldtp.Ldtp("*Notepad"); /* int i; string[] cmdArgs = { }; int ret = ldtp.LaunchApp("notepad", cmdArgs); Console.WriteLine("state #45 is {0}", ret); String[] windowList = ldtp.GetWindowList(); for (i = 0; i < windowList.Length; i++) Console.WriteLine(windowList[i]); String[] appList = ldtp.GetAppList(); for (i = 0; i < appList.Length; i++) Console.WriteLine(appList[i]); String[] objList = ldtp.GetObjectList(); for (i = 0; i < objList.Length; i++) Console.WriteLine(objList[i] + " "); /**/ Console.WriteLine("Notepad: " + ldtp.GuiExist()); Console.WriteLine("Notepad: " + ldtp.GuiExist("Cancel")); }
static void Main(string[] args) { string exepath = @"C:\Users\jimp\Projects\AStyleWx\build\vs2013_3.0\debug\AStyleWxd.exe"; string[] noargs = new string[1] { "" }; Console.WriteLine("Running C#"); Console.WriteLine("Creating ldtp"); Ldtp.Ldtp ldtp = new Ldtp.Ldtp("*AStyleWx"); if (ldtp == null) { Console.WriteLine("Cannot create ldtp object"); Console.WriteLine("The program has terminated!"); Environment.Exit(1); } if (!System.IO.File.Exists(exepath)) { Console.WriteLine("Cannot find executable: " + exepath); Console.WriteLine("The program has terminated!"); Environment.Exit(1); } Console.WriteLine("Launching AStyleWx"); try { ldtp.LaunchApp(exepath, noargs); } catch (Exception e) { Console.WriteLine("Error in launchapp: " + exepath); Console.WriteLine(e.Message); Console.WriteLine("The program has terminated!"); Environment.Exit(1); } if (ldtp.WaitTillGuiExist() == 0) { Console.WriteLine("Error in WaitTillGuiExist"); Console.WriteLine("The program has terminated!"); Environment.Exit(1); } string[] SubMenus = new string[20]; Console.WriteLine("\nFile"); SubMenus = ldtp.ListSubMenus("mnuFile"); PrintSubMenus(SubMenus); Console.WriteLine("\nEdit"); SubMenus = ldtp.ListSubMenus("mnuEdit"); PrintSubMenus(SubMenus); Console.WriteLine("\nSearch"); SubMenus = ldtp.ListSubMenus("mnuSearch"); PrintSubMenus(SubMenus); Console.WriteLine("\nView"); SubMenus = ldtp.ListSubMenus("mnuView"); PrintSubMenus(SubMenus); Console.WriteLine("\nTools"); SubMenus = ldtp.ListSubMenus("mnuTools"); PrintSubMenus(SubMenus); Console.WriteLine("\nHelp"); SubMenus = ldtp.ListSubMenus("mnuHelp"); PrintSubMenus(SubMenus); Console.WriteLine(); Console.WriteLine("Closing AStyleWx"); ldtp.SelectMenuItem("mnuFile;mnuExit"); if (ldtp.WaitTillGuiNotExist("frmAStyleWx") == 0) { Console.WriteLine("Error in WaitTillGuiNotExist: " + exepath); Console.WriteLine("The program has terminated!"); Environment.Exit(1); } Console.WriteLine("End of program!"); }