예제 #1
0
        internal void UploadFileToWorkSample()
        {
            string FilePath = Base.WorkSampleFile;

            Console.WriteLine("FilePath = " + FilePath);
            if (GlobalDefinitions.IsWindows())
            {
                //System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
                //Info.FileName = GlobalDefinitions.GetCodeDirectory() + @"..\..\FileUpload.exe";
                //try
                //{
                //    System.Diagnostics.Process.Start(Info);
                //}
                //catch (System.ComponentModel.Win32Exception e)
                //{
                //    Console.WriteLine("Can not find the exe", e.Message);
                //}
                //Thread.Sleep(10000);
                string WindowTitle = "Open";
                AutoItX.WinActivate(WindowTitle, "");
                AutoItX.ControlFocus(WindowTitle, "", "Edit1");
                //AutoItX.ControlSetText(WindowTitle, "", "Edit1", FilePath);
                AutoItX.Sleep(5000);
                AutoItX.Send(FilePath);
                AutoItX.Sleep(5000);
                AutoItX.ControlClick(WindowTitle, "", "Button1");
                Thread.Sleep(5000);
            }
            else
            {
                GlobalDefinitions.wait(5);
                WorSamplesFileElement.SendKeys(FilePath);
                GlobalDefinitions.wait(5);
            }
        }
예제 #2
0
        private void launchUriInChrome(String uri, String loginUserName, String loginPassword)
        {
            var options = new ChromeOptions();

            options.AddArgument("incognito");

            var driverService = ChromeDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            IWebDriver driver = new ChromeDriver(driverService, options);

            driver.Url = Convert.ToString(uri);

            if (loginUserName != "" && loginPassword != "")
            {
                AutoItX.WinWait("- Google Chrome", "", 1);
                AutoItX.WinActivate("- Google Chrome");
                AutoItX.Send(loginUserName);
                AutoItX.Send("{TAB}", 0);
                AutoItX.Send(loginPassword);
                AutoItX.Send("{TAB}", 0);
                AutoItX.Send("{Enter}", 0);
            }

            driver.Manage().Window.Maximize();

            //try { driver.Navigate().Refresh(); }
            //catch (OpenQA.Selenium.NoSuchWindowException e) { }
        }
예제 #3
0
        static void Main(string[] args)
        {
            //IWebDriver driver = new FirefoxDriver();
            //driver.Navigate().GoToUrl("http://www.google.com");

            //  AutoItX.Run("calc.exe", "");
            //AutoItX.Sleep(5000);
            // AutoItX.("Calculator", "", "[CLASS:Button; INSTANCE:14]");
            //AutoItX.ControlClick("Calculator", "", "139", "Left");
            //AutoItX.ControlClick("Calculator", "", "135", "Left");
            //AutoItX.ControlClick("Calculator", "", "94", "Left");
            //AutoItX.ControlClick("Calculator", "", "132", "Left");
            //AutoItX.ControlClick("Calculator", "", "121", "Left");

            //  Thread.Sleep(5000);

            //driver.Manage().Window.Maximize();
            //driver.Navigate().GoToUrl("http://spreadsheetpage.com/index.php/file/C35/P10/");
            //driver.FindElement(By.LinkText("smilechart.xls")).Click();

            //AutoItX.WinWaitActive("Opening smilechart.xls");
            //AutoItX.WinKill();


            AutoItX.Run("explorer.exe d:\\", "", 1);
            AutoItX.WinWaitActive("Untitled");
            AutoItX.Send("I'm in notepad I'm in notepad I'm in notepad I'm in notepad I'm in notepad");
            AutoItX.WinClose();
            Thread.Sleep(3000);
            AutoItX.WinWaitActive("Notepad");
            AutoItX.ControlClick("Notepad", "&Save", "Button1");
        }
예제 #4
0
 /// <summary>
 /// Seleciona Todo o Texto do Controle Atualmente com Foco e não faz mais nada, apenas Seleciona.
 /// </summary>
 public static void selecEntireTextFromControl()
 {
     AutoItX.Send("{HOME}");
     AutoItX.Send("{SHIFTDOWN}");
     AutoItX.Send("+{END}");
     AutoItX.Send("{SHIFTUP}");
 }
예제 #5
0
        internal void UploadPhoto()
        {
            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            switch (pid)
            {
            case PlatformID.Win32NT:
            case PlatformID.Win32S:
            case PlatformID.Win32Windows:
            case PlatformID.WinCE:
                AutoItX.Sleep(1000);
                AutoItX.WinWait("Open");
                AutoItX.Sleep(1000);
                AutoItX.WinActivate("Open");
                AutoItX.Sleep(1000);
                AutoItX.Send(DictionaryProperties.Details["ImgFileLocation"]);
                AutoItX.Sleep(5000);
                AutoItX.Send("{ENTER}");
                AutoItX.Sleep(3000);
                break;

            case PlatformID.Unix:
                Console.WriteLine("I'm on Linux!");
                break;

            default:
                Console.WriteLine("No Idea what I'm on!");
                break;
            }
        }
예제 #6
0
        public bool SendCommand(Command command)
        {
            int rv = AutoItX.WinActivate(GICValues.Instance.Application);

            if (rv == 0)
            {
                return(false);
            }
            else
            {
                if (command.activatorType == Command.KEY_DOWN)
                {
                    //if any modifiers, send them first
                    foreach (string modifier in command.Modifier)
                    {
                        AutoItX.Send("{" + modifier + "DOWN}");
                    }
                    //now send the key itself
                    AutoItX.Send("{" + command.Key + " down}");
                    //keep everything pressed for 10ms
                }
                else if (command.activatorType == Command.KEY_UP)
                {
                    AutoItX.Send("{" + command.Key + " up}");
                    //if any modifiers, unset them last
                    foreach (string modifier in command.Modifier)
                    {
                        AutoItX.Send("{" + modifier + "UP}");
                    }
                }
            }
            return(true);
        }
예제 #7
0
 public void SendAutoItKeys(string autoitKeys, string windowTitle)
 {
     Thread.Sleep(2000); // just in case some notification should appear
     AutoItX.WinActivate(windowTitle);
     AutoItX.Send(autoitKeys);
     // see https://www.autoitscript.com/autoit3/docs/functions/Send.htm for more information on keys
 }
예제 #8
0
        /// <summary>
        /// Анализ 100 Иностранцы
        /// </summary>
        /// <param name="logica">Какой анализ делаем</param>
        public void Status(int logica)
        {
            string status = "01";
            string tp     = "ТП";

            switch (logica)
            {
            case 1:
                status = "13";
                if (Inn == "ИНН:7707083893" && Kpp == "КПП:526002001")
                {
                    status = "15";
                }
                AutoItX.ControlClick(VedRazd1.Status[0], "", VedRazd1.Status[1]);
                AutoItX.Send(status);
                break;

            case 2:
                AutoItX.ControlClick(VedRazd1.SelectTp[0], "", VedRazd1.SelectTp[1]);
                AutoItX.Send(tp);
                break;

            case 3:
                AutoItX.ControlClick(VedRazd1.Status[0], "", VedRazd1.Status[1]);
                AutoItX.Send(status);
                AutoItX.ControlClick(VedRazd1.SelectTp[0], "", VedRazd1.SelectTp[1]);
                AutoItX.Send(tp);
                break;
            }
        }
예제 #9
0
        /// <summary>
        /// Уточнение платежей
        /// </summary>
        /// <param name="pathjurnalerror">Путь к журналу ошибок</param>
        /// <param name="pathjurnalok">Путь к журналу Ок</param>
        /// <param name="logica">Логика анализа</param>
        public void Click10(string pathjurnalerror, string pathjurnalok, int logica)
        {
            WindowsAis3 win       = new WindowsAis3();
            RegxStart   regxstart = new RegxStart();

            while (true)
            {
                var fulltext = ReadWindow.Read.Reades.HidenTextReturn(WindowsAis3.AisNalog3);
                regxstart.Parse(fulltext);
                if (regxstart.IsNulable)
                {
                    LibaryXMLAuto.ErrorJurnal.ErrorJurnal.JurnalError(pathjurnalerror, regxstart.RaschDoc, ModeBranchVedomost1, regxstart.Error);
                    break;
                }
                AutoItX.MouseClick(ButtonConstant.MouseLeft, win.WindowsAis.X + 45, win.WindowsAis.Y + 95);
                AutoItX.WinWait(Vedomost1Win.ViesneniePl[0], Vedomost1Win.ViesneniePl[1]);
                AutoItX.Send(ButtonConstant.Enter);
                regxstart.UseNalog(logica);
                AutoItX.MouseClick(ButtonConstant.MouseLeft, win.WindowsAis.X + 120, win.WindowsAis.Y + 80);
                AutoItX.WinWait(Vedomost1Win.Utoch[0], Vedomost1Win.Utoch[1]);
                AutoItX.Sleep(500);
                AutoItX.Send(ButtonConstant.Enter);
                AutoItX.WinWaitClose("АИС Налог-3 ПРОМ ", "Проведение уточнения");
                AutoItX.Send(ButtonConstant.Tab);
                LibaryXMLAuto.ErrorJurnal.OkJurnal.JurnalOk(pathjurnalok, regxstart.RaschDoc + " Подставили КБК: " + regxstart.KbkIfns + " вместо " + regxstart.Kbk100, "Удалось спарсить");
                AutoItX.Sleep(1000);
                break;
            }
        }
예제 #10
0
        /// <summary>
        /// Функция считывает данные с активного поданного контрола
        /// </summary>
        /// <param name="element">Наш контол Название ,идентификатор Name если numberbutton>0 то нажимается количество Tabov и парсится
        /// элемент после всех табов от ближайшего element</param>
        /// <param name="numberbutton">Количество нажатий Tab</param>
        /// <returns></returns>
        public static string ReadForm(string[] element, int numberbutton = 0)
        {
            string parametr = null;

            while (true)
            {
                if (String.IsNullOrWhiteSpace(parametr))
                {
                    AutoItX.ControlFocus(element[0], "", element[1]);
                    if (numberbutton > 0)
                    {
                        AutoItX.Send(String.Format(ButtonsClikcs.ButtonConstant.TabCountClick, numberbutton));
                    }
                    AutoItX.Sleep(500);
                    AutoItX.Send(ButtonsClikcs.ButtonConstant.CtrlC);
                    AutoItX.Send(ButtonsClikcs.ButtonConstant.CtrlC);
                    parametr = AutoItX.ClipGet();
                }
                else
                {
                    AutoItX.ClipPut(null);
                    break;
                }
            }
            AutoItX.ClipPut(""); //Очистка буфера обмена
            return(parametr);
        }
예제 #11
0
파일: Store.cs 프로젝트: Ceeeeed/TFT-BOT
    public static void Sell(int index)
    {
        Point pos = Board.GetPosition(index);

        AutoItX.MouseMove(pos.X, pos.Y, 15);
        AutoItX.Send("e");
    }
예제 #12
0
        private void UstawPrzegladanie()
        {
            int licznik = 0;

            if (AutoItX.WinActivate("EUKW - Prezentacja Księgi Wieczystej - Mozilla Firefox", "") == 1)
            {
                AutoItX.MouseMove(2210, 606);

                string tekst   = "";
                int    kolumna = 606;
                while (tekst != @"

Przeglądanie treści księgi wieczystej ")
                {
                    kolumna += 20;
                    AutoItX.MouseMove(2210, kolumna);
                    AutoItX.MouseClick("LEFT", 2210, kolumna, 3);
                    AutoItX.Send("^c");
                    licznik += 1;
                    tekst    = Clipboard.GetText();

                    if (licznik == 500)
                    {
                        throw new System.Exception("Za dlugo");
                    }
                }


                AutoItX.MouseMove(2210, kolumna + 70);
            }
        }
예제 #13
0
        /// <summary>
        /// Document checkin message click mark as complete
        /// </summary>
        public void DocumentCheckinMessgaeClickMarkAsComplete()
        {
            // Add Script for Checkin Msg
            // Process.Start(@"C:\Projects\AutoIT\AutoItX Scripts\CheckinScript.exe");
            AutoItX.WinActivate("Mark as complete");
            var winHandle = AutoItX.WinGetHandle("[REGEXPCLASS:(?i)HwndWrapper[ElementsDesktopClient.exe;;.*]]");

            AutoItX.WinActivate(winHandle);
            AutoItX.ControlClick("Mark as complete", "", "TextBlock");
            AutoItX.MouseClick("left", 1);
            AutoItX.MouseClick("left", 1);

            AutoItX.WinActivate("[REGEXPCLASS:(?i)HwndWrapper[ElementsDesktopClient.exe;;.*]]");
            var winTitle = AutoItX.WinGetTitle("[REGEXPCLASS:(?i)HwndWrapper[ElementsDesktopClient.exe;;.*]]");

            CommonMethods.PlayWait(3000);

            AutoItX.WinActivate(@"[X:1535\Y:842\W:356\H:188]");

            //Click on the edc
            AutoItX.MouseClick();

            //Select master as complete
            AutoItX.Send("{ENTER}");

            //Move to the ok button
            AutoItX.Send("{TAB}");
            AutoItX.Send("{TAB}");
            AutoItX.Send("{TAB}");

            //Click on ok button
            AutoItX.Send("{ENTER}");
            AutoItX.MouseClick();
        }
예제 #14
0
        private void ChangeDownloadPath(string targetPath)
        {
            if (!Directory.Exists(targetPath))
            {
                Directory.CreateDirectory(targetPath);
            }
            string currentPath = AutoItX.ControlGetText("[TITLE:Save As; CLASS:#32770]", "", "[CLASS:ToolbarWindow32; INSTANCE:4]");

            if (!currentPath.Contains(targetPath))
            {
                AutoItX.WinActivate("[TITLE:Save As; CLASS:#32770]", "");
                IntPtr w = AutoItX.WinGetHandle("[TITLE:Save As; CLASS:#32770]", "");
                IntPtr c = AutoItX.ControlGetHandle(w, "[CLASS:ToolbarWindow32; INSTANCE:4]");

                Rectangle mainWindowPosition = AutoItX.WinGetPos(w);
                Rectangle refElementPosition = AutoItX.ControlGetPos(w, c);
                int       startX             = mainWindowPosition.X + refElementPosition.X + refElementPosition.Width - 10;
                int       startY             = mainWindowPosition.Y + refElementPosition.Y + refElementPosition.Height / 2;

                AutoItX.MouseMove(startX + 15, startY + 25);
                AutoItX.MouseClick("LEFT", startX + 15, startY + 25);
                AutoItX.Send("{BACKSPACE}");

                AutoItX.AutoItSetOption("SendKeyDelay", GetRandomDelay(50));
                AutoItX.Send(targetPath);
                Thread.Sleep(TimeSpan.FromSeconds(1));
                AutoItX.Send("{ENTER}");
            }
        }
예제 #15
0
        private void Record_Ancortek25(Object stateinfo)
        {
            string name = getzero((1).ToString()) + getzero(Action.ToString()) + getzero(Angle.ToString()) + getzero(Person.ToString()) + "_" + getzero(Iteration[1].ToString());

            prevAction       = Action;
            prevAngle        = Angle;
            prevPerson       = Person;
            prevIteration[2] = Iteration[4];
            prevRadar        = 1;
            prevFileName     = name + ".dat";
            Thread.Sleep(seconds * 1000);
            _WinWaitActivate("Save Recorded Session", "", 30);

            AutoItX.Send(name);

            for (int i = 0; i < 6; i++)
            {
                AutoItX.Send("{TAB}");
            }
            AutoItX.Send("{ENTER}");
            AutoItX.Send(@"C:\Users\RSL\Documents\GestureDataRepo\");
            AutoItX.Send("{ENTER}");
            for (int i = 0; i < 9; i++)
            {
                AutoItX.Send("{TAB}");
            }
            AutoItX.Send("{ENTER}");
            // _WinWaitActivate("Radar", "Action:", 15);
            //  speaker.Speak("Recording Complete");
            show_spectogram(@"C:\Users\RSL\Documents\GestureDataRepo\" + name);
        }
예제 #16
0
        static void DownloadQuote()
        {
            string title = "盘后数据下载";

            int handle = AutoItX.WinWait(title, "", 10);

            if (handle == 0)
            {
                throw new InvalidOperationException("failed to find dialog for downloading quote");
            }

            IntPtr hwnd = AutoItX.WinGetHandle(title, "");

            AutoItX.WinActivate(hwnd);

            // select the "日线和实时行情数据" checkbox
            AutoItX.Send("{SPACE}");

            // click the download button
            IntPtr buttonDownload = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Button9]");

            AutoItX.ControlClick(hwnd, buttonDownload);

            AutoItX.Sleep(2000);

            // wait until the close button is enabled.
            IntPtr buttonClose = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Button10]");

            while (AutoItX.ControlCommand(hwnd, buttonClose, "IsEnabled", "") == "0")
            {
                AutoItX.Sleep(1000);
            }

            AutoItX.ControlClick(hwnd, buttonClose);
        }
예제 #17
0
        public void EditInNotepad()
        {
            logger.Info("Executing keyword 'EditInNotepad'");
            IntPtr winHandle;
            int    pid = AutoItX.Run("notepad.exe", ".");

            winHandle = GetProcessHandel(pid);

            if (AutoItX.WinWaitActive(winHandle, timeout: 10) != 1)
            {
                output.SetError("Error waiting for the Notepad window .");
                return;
            }

            AutoItX.Send("This is an AutoIt test using step");

            if (AutoItX.WinKill(winHandle) != 1)
            {
                output.SetError("Error closing the Notepad window");
                return;
            }

            if (AutoItX.WinWaitClose(winHandle, timeout: 10) != 1)
            {
                output.SetError("Error waiting for the Notepad window to close");
                return;
            }
        }
예제 #18
0
        static void Login(string account, string password)
        {
            string title = "中信证券金融终端";

            int handle = AutoItX.WinWait(title, "", 10);

            if (handle == 0)
            {
                throw new InvalidOperationException("failed to find login window");
            }

            IntPtr hwnd = AutoItX.WinGetHandle(title, "");

            AutoItX.WinActivate(hwnd);

            IntPtr hwndAccount  = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:SafeEdit1]");
            IntPtr hwndPassword = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:SafeEdit2]");

            AutoItX.ControlSetText(hwnd, hwndAccount, account);
            AutoItX.ControlSetText(hwnd, hwndPassword, password);

            AutoItX.Sleep(2000); // wait 2s

            AutoItX.Send("{ENTER}");
        }
예제 #19
0
        /// <summary>
        /// Document Verification
        /// </summary>
        /// <param name="reportFormat"></param>
        /// <param name="reportName"></param>
        /// <param name="caseTitle"></param>
        /// <param name="registryEntryTile"></param>
        /// <param name="screenedRegistryTitleFull"></param>
        public void ReportVerification(string reportFormat, string reportName, string caseTitle, string registryEntryTile, string screenedRegistryTitleFull = "")
        {
            try
            {
                string clipboardTextPDF = string.Empty;
                Clipboard.Clear();
                if (reportFormat == ReportFormat.PDF.GetStringValue() || reportFormat == ReportFormat.Text.GetStringValue() || reportFormat == ReportFormat.HTML.GetStringValue())
                {
                    var tabs = _driver.WindowHandles;
                    _driver.SwitchTo().Window(tabs[1]);

                    var databaseName = FrontPage.Elements.DatabaseName;
                    AutoItX.WinActivate("Elements - " + databaseName + " - Google Chrome", "");

                    CommonMethods.PlayWait(5000);

                    AutoItX.MouseClick();
                    AutoItX.Send("{ENTER}");
                    AutoItX.Send("^a");
                    AutoItX.Send("^c");

                    clipboardTextPDF = Clipboard.GetText();
                }
                if (reportFormat == ReportFormat.Word.GetStringValue())
                {
                }

                VerifyContents(reportFormat, reportName, caseTitle, registryEntryTile, screenedRegistryTitleFull, clipboardTextPDF);
            }
            catch (System.Exception ex)
            {
                var exception = ex;
            }
        }
예제 #20
0
 private static void ClearText()
 {
     //1.Gửi Ctrl + A để chọn tất cả
     AutoItX.Send("^a");
     //2.Gửi phím nhấn để xóa
     AutoItX.Send("{BS}");
 }
예제 #21
0
        /* PICTURE */
        public IWebDriver Picture(IWebDriver webDriver, Utilities utils, UserData usrData, ref int passCount, ref int failCount)
        {
            string imagePath = Directory.GetCurrentDirectory() + "\\assets\\dot.jpg";
            string imgText   = "Blue.jpg";

            utils.RandomPause(1.5);

            webDriver.FindElement(By.CssSelector("li.cc-user-widget")).Click();

            utils.RandomPause(1.2);

            webDriver.FindElement(By.ClassName("cc-image-uploader-save-btn")).Click();

            utils.RandomPause(1.2);

            webDriver.FindElement(By.CssSelector(".cc-file-input-container > label:nth-child(2)")).Click();

            utils.RandomPause(1);

            AutoItX.WinWaitActive("Open");
            AutoItX.ControlGetFocus("Open", "Edit1");
            AutoItX.Send("Blue.jpg");
            AutoItX.ControlGetFocus("Open", "Button1"); // Button1
            AutoItX.Send("{ENTER}");

            return(webDriver);
        }
예제 #22
0
        /**
         *  Nagivate to a web page (using Selenium) that requires authentication, and log in.
         *
         *  Note: This doesn't require AutoItX - it can be done with System.Windows.Forms -> SendKeys.SendWait() (see below).
         */
        public void OpenAndLoginSelenium(string username, string password)
        {
            var driverService = ChromeDriverService.CreateDefaultService();

            driverService.HideCommandPromptWindow = true;
            Instance = new ChromeDriver(driverService);
            //Instance = new FirefoxDriver();

            Instance.Navigate().GoToUrl("http://my-lab-drop2.telecomputing.com");
            //Instance.Navigate().GoToUrl("https://flow.telecomputing.com");
            //Instance.Navigate().GoToUrl("http://aev25.no");
            //AutoItX.WinActivate("Authentication required", "");
            AutoItX.Send(username);
            //AutoItX.Send("{TAB}");
            //AutoItX.Send(password);
            //AutoItX.Send("{TAB}");
            //AutoItX.Send("{ENTER}");

            //SendKeys.SendWait(username);
            //SendKeys.SendWait("{TAB}");
            //SendKeys.SendWait(password);

            //Instance.SwitchTo().Alert().SetAuthenticationCredentials("test", "test");
            //Instance.SwitchTo().Alert().Accept();

            //IAlert confirmationAlert = Instance.SwitchTo().Alert();
            //confirmationAlert.Dismiss();
        }
예제 #23
0
        public void Code(CancellationToken cancel)
        {
            if (cancel.IsCancellationRequested)
            {
                return;
            }

            string win_desc = "[REGEXPTITLE:Ember Bootloader and Range Test .*]";
            IntPtr hwnd     = activate_win(win_desc);

            AutoItX.MouseMove(_point_State_color.X, _point_State_color.Y, 0);

            AutoItX.Send("{SPACE}");
            Thread.Sleep(2000);

            Stopwatch watch = new Stopwatch();

            watch.Start();
            int    pixel_color = 0;
            string msg;

            while (true)
            {
                if (cancel.IsCancellationRequested)
                {
                    break;
                }

                pixel_color = AutoItX.PixelGetColor(_point_State_color.X, _point_State_color.Y);

                if (pixel_color == _cred)
                {
                    AutoItX.MouseMove(_point_State_color.X, _point_State_color.Y, 0);
                    msg = string.Format("Red pixel at location X={0}, Y={1} after {2:F2} s",
                                        _point_State_color.X, _point_State_color.Y, watch.Elapsed.TotalSeconds);
                    throw new Exception(msg);
                }
                else if (pixel_color == _cgreen)
                {
                    break;
                }


                Thread.Sleep(500);
                if (watch.Elapsed > _timeout)
                {
                    AutoItX.MouseMove(_point_State_color.X, _point_State_color.Y, 0);
                    msg = string.Format("Timeout after {0:hh\\:mm\\:ss}. Unable to detect green or read pixel at location X={1}, Y={2}",
                                        watch.Elapsed, _point_State_color.X, _point_State_color.Y);
                    throw new Exception(msg);
                }

                if (AutoItX.WinActive(hwnd) == 0)
                {
                    AutoItX.WinActivate(hwnd);
                    AutoItX.MouseMove(_point_State_color.X, _point_State_color.Y, 0);
                }
            }
        }
예제 #24
0
        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            if (ProcOpen)
            {
                ProcOpenLabel.ForeColor   = Color.Green;
                playerNameLabel.ForeColor = Color.Green;
                ProcOpenLabel.Text        = "Game Found";
                playerNameLabel.Text      = m.ReadString("base+1DB5789");
                gardenCBox.Enabled        = true;
            }
            else
            {
                ProcOpenLabel.ForeColor = Color.Red;
                ProcOpenLabel.Text      = "N/A";
                gardenCBox.Enabled      = false;
                return; // do not continue if process is not available/open
            }

            if (gardenCBox.Checked && gardenCBox.Enabled)
            {
                string bubbleText = m.ReadString("base+01D69E68,C8,1F0,0");
                // gardenCBox.Text = bubbleText;
                byte[] arr1 = { 0 };
                if (System.Convert.ToBoolean(m.ReadByte("base+1D8DE60")))
                {
                    if (bubbleText.Contains("is ready"))
                    {
                        AutoItX.Sleep(200);
                        AutoItX.Send("{numpad0}");
                        AutoItX.Sleep(100);
                        AutoItX.Send("{numpad0}");
                        AutoItX.Sleep(300);
                    }

                    if (bubbleText.Contains("is nothing"))
                    {
                        AutoItX.Sleep(200);
                        short[] seq = { 0, 0, 0, 0, 6, 0, 0, 2, 4, 0, 4, 0 };
                        foreach (var item in seq)
                        {
                            AutoItX.Send("{numpad" + item + "}");
                            AutoItX.Sleep(100);
                        }
                    }


                    if (bubbleText.Contains("is doing"))
                    {
                        AutoItX.Sleep(200);
                        AutoItX.Send("{numpad0}");
                        AutoItX.Sleep(100);
                        AutoItX.Send("{numpad2}");
                        AutoItX.Sleep(100);
                        AutoItX.Send("{numpad0}");
                        AutoItX.Sleep(200);
                    }
                }
            }
        }
예제 #25
0
 public void Send(string sendText)
 {
     if (wait_time > 0)
     {
         AutoItX.Sleep(wait_time);
     }
     AutoItX.Send(sendText);
 }
예제 #26
0
 /// <summary>
 /// Handling Alert pop up for OpenElementsDesktopClient
 /// </summary>
 public void HandleAlertPopupToOpenWordDocument()
 {
     CommonMethods.PlayWait(5000);
     AutoItX.WinWait("Untitled - Google Chrome", "", 2);
     AutoItX.WinActivate("Untitled - Google Chrome"); // Activate so that next set of actions happens on this window
     AutoItX.Send("{LEFT}");
     AutoItX.Send("{Enter}");
 }
예제 #27
0
        public static void GetAutoIt(string windowName, string textToType, int waitTime = 2)
        {
            AutoItX.WinActivate(windowName);

            AutoItX.Send(textToType);
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(waitTime));
            AutoItX.Send("{ENTER}");
        }
예제 #28
0
 /// <summary>
 /// Seleciona Todo o Texto do Controle Atualmente com Foco e o *APAGA*.
 /// </summary>
 public static void selectTextAndClear()
 {
     AutoItX.Send("{HOME}");
     AutoItX.Send("{SHIFTDOWN}");
     AutoItX.Send("+{END}");
     AutoItX.Send("{SHIFTUP}");
     AutoItX.Send("{DELETE}");
 }
예제 #29
0
 public static void login()
 {
     AutoItX.WinWaitActive();
     AutoItX.Send("harry");
     AutoItX.Send("{TAB}");
     AutoItX.Send("secret");
     AutoItX.Send("{ENTER}");
 }
예제 #30
0
 public void KeyDoublePressHoldDelay(string key, int delayTime = 400)
 {
     AutoItX.Send("{" + key + "}");
     Thread.Sleep(50);
     AutoItX.Send("{" + key + " down}");
     Thread.Sleep(delayTime);
     AutoItX.Send("{" + key + " Up}");
 }