예제 #1
0
        public AxiUmPuppet(HwndObject axiUm)
        {
            Stuff.Init();
            Thread.Sleep(1000);

            this.axiUm = axiUm;
            axiUm.Activate();
            WindowScrape.Static.HwndInterface.ShowWindow(axiUm.Hwnd, 3);
            Thread.Sleep(1000);

            // Maximize AxiUm if it already isn't
            axiUm.Maximize();

            // Close any open reports to ensure axiUm is in its default resting state
            ClearOpenReports();
        }
예제 #2
0
        public void SaveExcel(string path)
        {
            HwndObject window = HwndObject.GetForegroundWindow();

            if (!window.Title.Contains("Excel") && !window.Title.StartsWith("Book"))
            {
                foreach (HwndObject o in HwndObject.GetWindows().FindAll(e => e.Title.Contains("Excel")))
                {
                    if (o.Title.StartsWith("Book"))
                    {
                        if (window == null)
                        {
                            window = o;
                        }
                        else if (Int32.TryParse(o.Title.Substring(4), out int number))
                        {
                            if (number > Int32.Parse(window.Title.Substring(4)))
                            {
                                window = o;
                            }
                        }
                    }
                }
            }

            if (window == null)
            {
                Console.ForegroundColor = Colors.Error;
                Console.WriteLine("Unable to export report from Axium");
                return;
            }
            else
            {
                Console.ForegroundColor = Colors.Success;
                Console.WriteLine("Excel file opened: " + window.Title);
            }

            window.Activate();
            Thread.Sleep(2000);
            window.Maximize();
            Thread.Sleep(2000);
            Input.PressKeyCombo(Input.KEY_CONTROL, Input.KEY_S);
            Thread.Sleep(2000);

            Input.MoveTo(new Point(800, 635));
            Thread.Sleep(500);
            Input.RegisterClick();
            Thread.Sleep(500);

            Input.MoveTo(new Point(570, 195));
            Thread.Sleep(500);
            Input.RegisterClick();
            Thread.Sleep(500);

            HwndObject saveDialog = HwndObject.GetWindows().Find(e => e.Title.Contains("Save As"));

            Stuff.WriteConsoleMessage("Save dialog found!");
            saveDialog.Activate();
            Thread.Sleep(500);
            Input.KeyboardWrite(path, 100);
            Thread.Sleep(100);
            Input.PressKeyCombo(Input.KEY_ALT, Input.KEY_S);
            Thread.Sleep(2000);

            if (!File.Exists(path + ".xlsx"))
            {
                Stuff.WriteConsoleError("File was not saved...trying again");
            }
            else
            {
                window.CloseWindow();
                Stuff.WriteConsoleSuccess("File was saved to " + path);
            }
        }