private HwndObject getMainContainer() { List <HwndObject> list = axiUm.GetChildren(); if (list.Count != 3) { Console.ForegroundColor = Colors.Error; foreach (HwndObject o in list) { Console.WriteLine(Stuff.GetHwndInfoString(o)); } throw new Exception("Axium changed its top level children count"); } else { var mainContainer = list[1]; if (!mainContainer.ClassName.Equals("MDIClient")) { Console.ForegroundColor = Colors.Message; foreach (HwndObject o in list) { Console.WriteLine(Stuff.GetHwndInfoString(o)); } Console.WriteLine("It is unclear if this window is the one you want"); } return(mainContainer); } }
private void ExecuteQuery() { HwndObject startWindow = HwndObject.GetForegroundWindow(); Input.PressKeyCombo(Input.KEY_ALT, Input.KEY_S); Stopwatch watch = Stopwatch.StartNew(); Thread.Sleep(500); HwndObject fetching = null; foreach (HwndObject o in HwndObject.GetWindows()) { List <HwndObject> list = o.GetChildren(); if (list.Count != 3) { continue; } if (list[1].Title.Equals("Please wait...") || list[1].Title.Equals("Fetching Data...")) { Stuff.WriteConsoleMessage("Parent: " + Stuff.GetHwndInfoString(o.GetParent())); fetching = list[0]; break; } } while (HwndObject.GetForegroundWindow() != startWindow) { Console.Write("Waiting... (" + watch.ElapsedMilliseconds + ")"); if (fetching != null) { Console.WriteLine(fetching.Text); } else { Console.WriteLine(); } Thread.Sleep(5000); } watch.Stop(); Stuff.WriteConsoleSuccess("Report Generated"); }
private void ExportQuery() { Input.PressKeyCombo(Input.KEY_ALT, Input.KEY_A); Thread.Sleep(5000); HwndObject startWindow = HwndObject.GetForegroundWindow(); Input.PressKeyCombo(Input.KEY_ALT, Input.KEY_E); Thread.Sleep(1000); Input.MoveTo(new Point(870, 405)); Input.RegisterClick(); Thread.Sleep(500); Input.PressKeyCombo(Input.KEY_ALT, Input.KEY_O); Stopwatch watch = Stopwatch.StartNew(); Thread.Sleep(10000); HwndObject progress = null; foreach (HwndObject o in HwndObject.GetWindows()) { List <HwndObject> list = o.GetChildren(); if (list.Count <= 1) { continue; } if (list[1].Title.Equals("Processing")) { Stuff.WriteConsoleMessage(Stuff.GetHwndInfoString(list[0])); progress = list[0]; break; } } int excelWindowCount = HwndObject.GetWindows().FindAll(e => e.Title.Contains("Excel")).Count; while (true) { HwndObject window = HwndObject.GetForegroundWindow(); if (window.Title.Contains("Excel") && window.Title.StartsWith("Book")) { Stuff.WriteConsoleMessage("Found opened window"); break; } else if (HwndObject.GetWindows().FindAll(e => e.Title.Contains("Excel")).Count == (excelWindowCount + 1)) { Stuff.WriteConsoleMessage("Detected change in excel window counts"); break; } Console.Write("Waiting... (" + watch.ElapsedMilliseconds + ")"); if (progress != null) { Console.WriteLine(" " + progress.Text); } else { Console.WriteLine(); } Thread.Sleep(5000); } watch.Stop(); Stuff.WriteConsoleSuccess("Data exported"); }