Пример #1
0
        public void OmniStgLogin()
        {
            Utilities utility = new Utilities();

            test = report.StartTest("Omni Stage Login");

            driver.Url = ConfigurationManager.AppSettings["OmniStg"];
            driver.Manage().Window.Maximize();

            // Login to Omni
            var login = new PageObjects.OmniObjects(driver);

            login.loginOmni();

            if (AutoItX.WinWaitActive("[CLASS:SunAwtDialog]", "", 10) == 1)
            {
                //Click Run on Java applet
                autoIt.MouseClick("left", 894, 502);
            }
            var pagedata = driver.FindElement(By.Id("ctl00_Content_Main_hlnkOfcStatus")).Text;

            Assert.IsTrue(pagedata.Contains("Office status"), pagedata + " Was not found");
            test.Log(LogStatus.Pass, "Login Succesful");
            Utilities.TakeScreenshot(driver, @"C:\Automation\Screenshots\Results.png");
        }
Пример #2
0
        // Блок
        private void timer2_Tick(object sender, EventArgs e)
        {
            AutoItX3 autoIt = new AutoItX3();

            if (autoIt.WinExists("ОШИБКА") == 1)
            {
                string t   = autoIt.ControlGetText("ОШИБКА", "", "TStaticText1");
                string pos = "ПЕРЕПОЛНЕНИЕ";
                if (t.Contains(pos))
                {
                    autoIt.WinActivate("ОШИБКА");
                    autoIt.WinGetState("ОШИБКА");
                    autoIt.ControlClick("ОШИБКА", "", "[CLASS:TBitBtn; INSTANCE:1]", "main", 1);
                    autoIt.Sleep(5000);
                    autoIt.WinClose(textBox2.Text);
                    autoIt.Sleep(4000);
                    autoIt.WinActivate("ЗАВЕРШЕНИЕ РАБОТЫ");
                    autoIt.WinGetState("ЗАВЕРШЕНИЕ РАБОТЫ");
                    autoIt.Sleep(2000);
                    autoIt.ControlClick("ЗАВЕРШЕНИЕ РАБОТЫ", "", "[CLASS:Button; INSTANCE:1]", "main", 1);
                    autoIt.Sleep(Convert.ToInt16(textBox5.Text));
                    autoIt.Run(textBox1.Text);
                    autoIt.Sleep(7000);
                    autoIt.WinActivate("ВЫБОР БИБЛИОТЕК");
                    autoIt.WinGetState("ВЫБОР БИБЛИОТЕК");
                    autoIt.Sleep(3000);
                    //Выбор библиотеки поцвету пикселя начало
                    object   coord      = autoIt.PixelSearch(0, 0, Screen.GetWorkingArea(this).Width, Screen.GetWorkingArea(this).Height, Convert.ToInt32(Convert.ToString(textBox3.Text), 16));//edit texbox3 hex
                    object[] pixelcoord = (object[])coord;
                    autoIt.MouseClick("Left", (int)pixelcoord[0], (int)pixelcoord[1], 1, 10);
                    //Выбор библиотеки поцвету пикселя конец
                    autoIt.Sleep(Convert.ToInt16(textBox6.Text));
                    //Запуск PostWin поцвету пикселя начало
                    autoIt.WinActivate(textBox2.Text);
                    autoIt.WinGetState(textBox2.Text);
                    autoIt.Sleep(2000);
                    object   coord1      = autoIt.PixelSearch(0, 0, Screen.GetWorkingArea(this).Width, Screen.GetWorkingArea(this).Height, Convert.ToInt32(Convert.ToString(textBox4.Text), 16));//edit textbox4 hex
                    object[] pixelcoord1 = (object[])coord1;
                    autoIt.MouseClick("Left", (int)pixelcoord1[0], (int)pixelcoord1[1], 1, 10);
                    //Запуск PostWin поцвету пикселя конец
                    autoIt.Sleep(2000);
                    //*** Запись лога
                    string date = DateTime.Now.ToString("dd MMMM yyyy,HH:mm:ss");
                    System.IO.StreamWriter writer = new System.IO.StreamWriter("slib.dll", true);
                    writer.WriteLine(date);
                    writer.Close();
                    //*** Запись лога конец
                }
                else
                {
                    timer2.Interval = 1;  // Выбираем из массива случайное значение для таймера
                }
            }
        }
Пример #3
0
        static public void au3_clickright(int x, int y)
        {
            AutoItX3 au3 = new AutoItX3();

            au3.MouseClick("right", Xx + x, Yy + y, 1, 0);
            Thread.Sleep(200);
        }
Пример #4
0
 public static void AceptCertificate()
 {
     Thread.Sleep(1000);
     autoit.WinActivate("Untitled - Google Chrome");
     autoit.MouseClick("LEFT", 814, 327, 1, -1);
     // autoit.ControlClick("Sample AV metrics - PowerPoint", "", "NetUIHWND1", "LEFT", 1, 46, 14) == 1)
 }
Пример #5
0
 public void FocusOnDiscord()
 {
     try
     {
         auto.WinActivate("[CLASS:Chrome_WidgetWin_1]", "");
         auto.WinMove("[CLASS:Chrome_WidgetWin_1]", "", 0, 0, 940, 500);
         System.Threading.Thread.Sleep(500);
         auto.MouseMove(308, 441, 1);
         auto.MouseClick("LEFT", 308, 441, 1, 1);
     } catch (System.NullReferenceException)
     {
         MessageBox.Show("Could not find the window, please try again!");
     } catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Пример #6
0
        private void btnCheckBlackList_Click(object sender, EventArgs e)
        {
            Random rand    = new Random();
            String hWnd    = au3.WinGetHandle("[TITLE:VIP72 Socks Client]");
            String hwndSTR = "[HANDLE:" + hWnd.ToString() + "]";

            au3.WinSetOnTop(hwndSTR, "", 1);
            int x = au3.WinGetPosX(hwndSTR, "") + 8;
            int y = au3.WinGetPosY(hwndSTR, "") + 30;

            x += au3.ControlGetPosX(hwndSTR, "", "[ID:116]");
            y += au3.ControlGetPosY(hwndSTR, "", "[ID:116]");
            int maxRand = rand.Next(14);

            au3.MouseClick("LEFT", x + 11, y + 30);
            au3.MouseClick("RIGHT", x + 11, y + 30 + maxRand * 17);
            //au3.MouseClick("RIGHT", x + 11, y + 30 + maxRand * 20);
            //au3.ControlClick(hwndSTR, "", "[ID:116]", "left", 1, 57, 35);
            //au3.ControlClick(hwndSTR, "", "[ID:116]", "right", 1, 11,  30 + maxRand * 18);
            au3.Send("{DOWN}");
            au3.Send("{DOWN}");
            au3.Send("{DOWN}");
            au3.Send("{DOWN}");
            au3.Send("{ENTER}");
            Boolean checkNotBlackist = waitText(au3, "[ACTIVE]", "[ID:33]", "is NOT black", "is BLACKLISTED", 30);

            au3.ControlClick("[ACTIVE]", "", "[ID:99]");
            if (checkNotBlackist)
            {
                au3.MouseClick("LEFT", x + 11, y + 30 + maxRand * 17, 2);
            }

            // MessageBox.Show("Login Success: " + checkNotBlackist);
            au3.WinSetOnTop(hwndSTR, "", 0);
        }
Пример #7
0
        public void catchPokemon(string pokemon = "not defined") // use different attack - 1 more argument
        {
            // setting string Pokemon equals pokemonName
            string pokemonName;

            pokemonName = pokemon;

            // Sleeping before battle has begun
            autoit.Sleep(2000);

            // A MouseClick is now simulated to kill the pokemon
            autoit.MouseClick("LEFT", catchPokemonX1, catchPokemonY1);

            // navigate bag 1/2
            autoit.Sleep(2500);

            autoit.MouseClick("LEFT", catchPokemonX2, catchPokemonY2);

            // navigate bag 2/2
            autoit.Sleep(1500);

            autoit.MouseClick("LEFT", catchPokemonX3, catchPokemonY3);

            // Use pokeball
            autoit.Sleep(1500);

            autoit.MouseClick("LEFT", catchPokemonX4, catchPokemonY4);

            // Sleeping here for a long time so we are sure that we are through catching sequence.
            autoit.Sleep(10000);
        }
Пример #8
0
        public void clearAllProxy()
        {
            au3.WinSetOnTop(hwndSTR, "", 1);
            int x = au3.WinGetPosX(hwndSTR, "") + 8;
            int y = au3.WinGetPosY(hwndSTR, "") + 30;

            x += au3.ControlGetPosX(hwndSTR, "", "[ID:117]");
            y += au3.ControlGetPosY(hwndSTR, "", "[ID:117]");
            au3.ControlClick(hwndSTR, "", "[ID:7303]");
            au3.MouseClick("LEFT", x + 11, y + 30);
            for (int i = 0; i < 50; i++)
            {
                au3.ControlSend(hwndSTR, "", "[ID:117]", "{DEL}");
            }
            au3.WinSetOnTop(hwndSTR, "", 0);
        }
Пример #9
0
        public void ClickMouseToWindow(int x, int y, int delayAfter = 0)
        {
            au3.MouseClick("left", x + window.X, y + window.Y);
            if (au3.error != 0)
            {
                console.WriteLine("Error: mouse not control.");
            }

            if (delayAfter > 0)
            {
                Thread.Sleep(TimeSpan.FromMilliseconds(delayAfter));
            }
        }
Пример #10
0
        private void StartWrok()
        {
            ai.WinActivate(WIN_TITLE);
            ai.WinWaitActive(WIN_TITLE);

            while (ai.WinActive(WIN_TITLE) == 1 && repeatedly > 0)
            {
                if (ai.PixelGetColor(865, 539) == 0x26AEF6)
                {
                    ai.MouseClick("LEFT", 865, 539, 1, 10);
                    ai.MouseMove(686, 313, 10);
                    while (ai.PixelGetColor(865, 539) == 0x26AEF6)
                    {
                        ai.MouseClick("LEFT", 686, 313, 1, 10);
                        Thread.Sleep(500);
                    }
                    while (ai.PixelGetColor(545, 612) != 0x121415)
                    {
                    }
                    repeatedly--;
                    everyCycleAction();
                }
            }
        }
Пример #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            getwindowrectangle();
            au3.WinActivate(WINDOW_NAME);
            au3.MouseMove(rect.left + 120, rect.top + 45, 1);
            au3.MouseClick("LEFT");
            Thread.Sleep(500);
            switch (counter)
            {
            case 1:
                au3.MouseMove(rect.left + 128, rect.top + 216, 1);
                au3.MouseClick("LEFT");
                break;

            case 2:
                au3.MouseMove(rect.left + 366, rect.top + 223, 1);
                au3.MouseClick("LEFT");
                break;

            case 3:
                au3.MouseMove(rect.left + 625, rect.top + 227, 1);
                au3.MouseClick("LEFT");
                break;

            case 4:
                au3.MouseMove(rect.left + 873, rect.top + 215, 1);
                au3.MouseClick("LEFT");
                break;

            default:
                MessageBox.Show("select a gamemode retard");
                break;
            }
            Thread.Sleep(500);
            au3.MouseMove(rect.left + 541, rect.top + 688, 1);
            au3.MouseClick("LEFT");
            Thread.Sleep(1500);
            au3.MouseMove(rect.left + 541, rect.top + 688, 1);
            au3.MouseClick("LEFT");
        }
Пример #12
0
 public void Reg()
 {
     for (int i = 0; i < 75; i++)
     {
         //bool isFinish = true;
         //while (isFinish)
         //{
         Thread.Sleep(50);
         _robot.ControlFocus("Registry Editor", "", "[CLASS:SysTreeView32; INSTANCE:1]");
         _robot.Send("{F3}");
         Thread.Sleep(300);
         _robot.Send("{TAB}");
         Thread.Sleep(50);
         _robot.Send("{LEFT}");
         Thread.Sleep(50);
         _robot.Send("{DELETE}");
         Thread.Sleep(50);
         _robot.ControlFocus("Confirm Key Delete", "", "[CLASS:Button; INSTANCE:1]");
         _robot.MouseClick("LEFT", 1069, 525, 1, 0);
         Thread.Sleep(50);
         // }
     }
 }
Пример #13
0
        private void Trigger()
        {
            while (true)
            {
                if (GetAsyncKeyState(Keys.F1) < 0)
                {
                    checkBox1.ForeColor = Color.Green;
                    checkBox1.Checked   = true;
                }
                if (GetAsyncKeyState(Keys.F2) < 0)
                {
                    checkBox1.ForeColor = Color.Red;
                    checkBox1.Checked   = false;
                }
                if (checkBox1.Checked)
                {
                    if (GetAsyncKeyState(Keys.RButton) < 0)
                    {
                        newCol        = GrabColor();
                        textBox1.Text = newCol.ToString();
                        if (newCol > 16551953)
                        {
                            Thread.Sleep(1);
                            au3.MouseClick("LEFT");
                        }
                    }

                    if (GetAsyncKeyState(Keys.F10) < 0)
                    {
                        this.Close();
                    }
                }

                Thread.Sleep(1);
            }
        }
Пример #14
0
 public void mouseClick(Point location)
 {
     waitABitLonger();
     autoIT.MouseClick("primary", location.X, location.Y);
     waitABitLonger();
 }
Пример #15
0
 public static void AutoClick(string positionXY)
 {
     autoIt.MouseClick("LEFT", Convert.ToInt32(positionXY.Split(',')[0]), Convert.ToInt32(positionXY.Split(',')[1]), 1, -1);
     Thread.Sleep(1000);
 }
Пример #16
0
 public void clicking(string Clickside)
 {
     auto1.MouseClick(Clickside);
 }
        public void ValidateManagerReports_Due_Diligence_Reporting()
        {
            try
            {
                driver = objbase.DriverInitialization();
                driver.Navigate().GoToUrl(ConfigurationSettings.AppSettings["QAT"]);
                driver.Manage().Window.Maximize();
                objbase.waitforPageload();
                IWebElement elegrmenu = driver.FindElement(By.Id("menu"));
                driver.SwitchTo().Frame(elegrmenu);
                IWebElement         elmgrlink       = driver.FindElement(By.LinkText("Manager Menu"));
                IJavaScriptExecutor Managerexecutor = (IJavaScriptExecutor)driver;
                Managerexecutor.ExecuteScript("arguments[0].click();", elmgrlink);
                objbase.waitforPageload();

                IWebElement elemmenumgrreports = driver.FindElement(By.LinkText("Manager Reports"));
                Managerexecutor.ExecuteScript("arguments[0].click();", elemmenumgrreports);
                driver.SwitchTo().Window(driver.WindowHandles.Last());
                //objbase.waitforPageload();

                bool elelistresult = objbase.validatelementexist(By.Id("list"));

                if (elelistresult)
                {
                    IWebElement frmlist = driver.FindElement(By.Id("list"));
                    driver.SwitchTo().Frame(frmlist);
                    IWebElement elmexporesummarylink = driver.FindElement(By.LinkText("Manager Due Diligence Reporting"));
                    Managerexecutor.ExecuteScript("arguments[0].click();", elmexporesummarylink);
                    driver.SwitchTo().Window(driver.WindowHandles.Last());
                    //  objbase.wait();
                }

                bool eleinvsmgrfundresult = objbase.validatelementexist(By.Id("Filters_SelectedInvestmentManagerId"));

                if (eleinvsmgrfundresult)
                {
                    IWebElement   eleselInvestmentcompany = driver.FindElement(By.Id("Filters_SelectedInvestmentManagerId"));
                    SelectElement seleInvestmentCompany   = new SelectElement(eleselInvestmentcompany);
                    seleInvestmentCompany.SelectByValue(ConfigurationSettings.AppSettings["MgrDueDiligence"]);
                    objbase.waitforPageload();
                }

                IWebElement   eleportfoliofund  = driver.FindElement(By.Id("AvailablePortfolioFunds"));
                SelectElement seleportfoliofund = new SelectElement(eleportfoliofund);
                seleportfoliofund.SelectByValue(ConfigurationSettings.AppSettings["MgrDueDiligencePortfolio"]);

                bool eleaddbtnresult = objbase.validatelementexist(By.Id("addPortfolioFund"));
                if (eleaddbtnresult)
                {
                    IWebElement eleaddbtn = driver.FindElement(By.Id("addPortfolioFund"));
                    Managerexecutor.ExecuteScript("arguments[0].click();", eleaddbtn);
                }

                bool elebtnreportresult = objbase.validatelementexist(By.Id("btnView"));

                if (elebtnreportresult)
                {
                    IWebElement elebtnreport = driver.FindElement(By.Id("btnView"));
                    Managerexecutor.ExecuteScript("arguments[0].click();", elebtnreport);
                    objbase.Waitformanagerreports();

                    AutoItX3 autox = new AutoItX3();
                    autox.WinWaitActive("Do you want to open or save", "", 10);
                    autox.MouseClick("Open", 320, 703, 1, -1);



                    /* int autoitrunresult = autox.Run("http://athena-qat/ - Manager Due Diligence Reporting","",50);
                     *
                     * int autointcountx =  autox.WinWaitActive("http://athena-qat/ - Manager Due Diligence Reporting","", 50);
                     * int controlclickresponse =   autox.ControlClick("http://athena-qat/ - Manager Due Diligence Reporting", "", "DirectUIHWND1", "RIGHT", 1, 924,749);
                     * autox.WinWait("http://athena-qat/ - Manager Due Diligence Reporting", "",50);
                     * int controlfocus =   autox.Run("http://athena-qat/ - Manager Due Diligence Reporting","", "DirectUIHWND1");
                     * Console.WriteLine("Control focus window response" + controlfocus);
                     * int controlclick =   autox.ControlClick("http://athena-qat/ - Manager Due Diligence Reporting","","DirectUIHWND1", "RIGHT",1,-8,-8);
                     * Console.WriteLine("Control click window response" + controlclick);
                     * SikuliSharp sk = new SikuliSharp(); */
                }
            }
            catch (Exception exduediligence)
            {
                Console.WriteLine("Exception Message - Due_Diligence_Reporting: " + exduediligence.Message.ToString());
            }
        }
Пример #18
0
 private void HighlightSession()
 {
     autoIt.MouseMove(500, 375);
     autoIt.Sleep(2000);
     autoIt.MouseClick("primary"); // Highlights the first session only
 }
Пример #19
0
 public void mClick(string strButton, int nX, int nY, int nClicks, int nSpeed)
 {
     auto.MouseClick(strButton, nX, nY, nClicks, nSpeed);
 }
Пример #20
0
        AutoItX3 auto = new AutoItX3(); //Decare to use DLL File of AutoIt

        public void mouseMoveAndClick(string ClickSide, int x, int y, int countClick, int speedMove)
        {
            auto.MouseClick(ClickSide, x, y, countClick, speedMove);
        }
Пример #21
0
 public void mClick(string ClickSide, int x, int y, int manyClick, int Speed)
 {
     auto.MouseClick(ClickSide, x, y, manyClick, Speed);
 }
Пример #22
0
        static void Main(string[] args)
        {
            //Variables
            AutoItX3 auto = new AutoItX3();
            AutoIt   AIT  = new AutoIt();

            int Numero = 0;
            ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0);
            Bitmap BuscarPartida          = new Bitmap("1_BuscarPartida.jpg");
            Bitmap PartidaEncontrada      = new Bitmap("2_PartidaEncontrada.jpg");
            Bitmap PartidaIniciada        = new Bitmap("3_PartidaIniciada.jpg");
            Bitmap Rendirse              = new Bitmap("4_Rendirse.jpg");
            Bitmap ConfirmarRendirse     = new Bitmap("5_ConfirmarRendirse.jpg");
            Bitmap VolverAJugar          = new Bitmap("6_VolverAJugar.jpg");
            Bitmap ReintentandoSurrender = new Bitmap("7_ReintentandoSurrender.jpg");
            Bitmap Salir         = new Bitmap("8_Salir.jpg");
            Bitmap ErrorConexion = new Bitmap("9_ErrorConexion.jpg");
            Bitmap Reconectar    = new Bitmap("10_Reconectar.jpg");

            //Ciclo
            while (Numero == 0)
            {
                var fecha = DateTime.Now.ToString("hh:mm:ss");
                try
                {
                    Bitmap   Captura = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format24bppRgb);
                    Graphics g       = Graphics.FromImage(Captura);

                    g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size);
                    //Captura.Save("captura.jpg");  // Guardamos la imagen

                    //Buscamos la partida
                    TemplateMatch[] matchings = tm.ProcessImage(BuscarPartida, Captura);
                    if (matchings[0].Similarity > 0.94f)
                    {
                        Console.WriteLine(fecha + " Buscando Partida");
                        Cursor.Position = new Point(850, 925);
                        auto.MouseClick("LEFT", 850, 925, 1, -1);
                        Thread.Sleep(2000);
                    }
                    else
                    {
                        //Encontramos la Paritda y la aceptamos
                        matchings = tm.ProcessImage(PartidaEncontrada, Captura);
                        if (matchings[0].Similarity > 0.95f)
                        {
                            Console.WriteLine(fecha + " Partida Encontrada");
                            Cursor.Position = new Point(958, 774);
                            auto.MouseClick("LEFT", 958, 774, 1, -1);
                        }
                        else
                        {
                            //Detectamos que la partida fue iniciada con normalidad
                            matchings = tm.ProcessImage(PartidaIniciada, Captura);
                            if (matchings[0].Similarity > 0.91f)
                            {
                                fecha = DateTime.Now.ToString("hh:mm:ss");
                                Console.WriteLine(fecha + " Partida Iniciada");
                                //Esperamos a la ruleta
                                Thread.Sleep(10000);
                                //Caminamos
                                fecha = DateTime.Now.ToString("hh:mm:ss");
                                Console.WriteLine(fecha + " Eligiendo campeon");
                                auto.MouseClick("RIGHT", 960, 350, 1, -1);
                                //Esperamos para comprar campeones
                                Thread.Sleep(60000);
                                //Compramos 2 Campeones
                                fecha = DateTime.Now.ToString("hh:mm:ss");
                                Console.WriteLine(fecha + " Comprando Campeones");
                                for (int i = 0; i < 6; i++)
                                {
                                    auto.MouseClick("LEFT", 560, 1000, 1, -1);
                                    Thread.Sleep(100);
                                }
                                Thread.Sleep(1000);
                                for (int i = 0; i < 6; i++)
                                {
                                    auto.MouseClick("LEFT", 780, 1000, 1, -1);
                                    Thread.Sleep(100);
                                }
                                Thread.Sleep(60000);

                                //Subimos de Nivel
                                for (int h = 0; h < 10; h++)
                                {
                                    //for (int h=0; h<14; h++) {
                                    fecha = DateTime.Now.ToString("hh:mm:ss");
                                    Console.WriteLine(fecha + " Subiendo de Nivel, Iteracion:" + h);
                                    for (int i = 0; i < 2; i++)
                                    {
                                        auto.MouseClick("LEFT", 360, 960, 1, -1);
                                        Thread.Sleep(600);
                                    }
                                    //Compramos 4 Campeones mas
                                    Console.WriteLine(fecha + " Comprando Campeones");
                                    for (int i = 0; i < 6; i++)
                                    {
                                        auto.MouseClick("LEFT", 560, 1000, 1, -1);
                                        Thread.Sleep(100);
                                    }
                                    Thread.Sleep(1100);
                                    for (int i = 0; i < 7; i++)
                                    {
                                        auto.MouseClick("LEFT", 780, 1000, 1, -1);
                                        Thread.Sleep(100);
                                    }
                                    Thread.Sleep(1100);
                                    for (int i = 0; i < 7; i++)
                                    {
                                        auto.MouseClick("LEFT", 960, 1000, 1, -1);
                                        Thread.Sleep(100);
                                    }
                                    Thread.Sleep(1100);
                                    for (int i = 0; i < 7; i++)
                                    {
                                        auto.MouseClick("LEFT", 1160, 1000, 1, -1);
                                        Thread.Sleep(100);
                                    }
                                    Thread.Sleep(1000);
                                    //Caminamos por el Mapa
                                    Console.WriteLine(fecha + " Caminando");
                                    auto.MouseClick("RIGHT", 1280, 600, 1, -1);
                                    Thread.Sleep(1000);
                                    auto.MouseClick("RIGHT", 965, 274, 1, -1);
                                    Thread.Sleep(1000);
                                    auto.MouseClick("RIGHT", 1300, 500, 1, -1);
                                    fecha = DateTime.Now.ToString("hh:mm:ss");
                                    //Esperar Minuto 10
                                    fecha = DateTime.Now.ToString("hh:mm:ss");
                                    Thread.Sleep(65000);
                                }
                                Console.WriteLine(fecha + " Intentando Tirar Surrender");
                                for (int i = 0; i < 10; i++)
                                {
                                    Cursor.Position = new Point(1905, 886);
                                    auto.MouseClick("LEFT", 1905, 886, 1, -1);
                                    Thread.Sleep(100);
                                }
                                for (int i = 0; i < 3; i++)
                                {
                                    auto.MouseClick("LEFT", 750, 870, 1, -1);
                                }
                                Thread.Sleep(1000);
                                Console.WriteLine(fecha + " Corfirmando Surrender ");
                                for (int i = 0; i < 10; i++)
                                {
                                    auto.MouseClick("LEFT", 1030, 490, 1, -1);
                                    Thread.Sleep(100);
                                }
                                Thread.Sleep(5000);
                                // auto.MouseClick("LEFT", 617, 428, 1, -1);
                                Thread.Sleep(6000);
                                //  auto.MouseClick("LEFT", 617, 428, 1, -1);
                                // Thread.Sleep(6000);
                                auto.MouseClick("LEFT", 830, 935, 1, -1);
                            }
                            else
                            {
                                //Precionando Rendirse en el menu ESC
                                matchings = tm.ProcessImage(Rendirse, Captura);
                                if (matchings[0].Similarity > 0.95f)
                                {
                                    for (int i = 0; i < 3; i++)
                                    {
                                        auto.MouseClick("LEFT", 750, 870, 1, -1);
                                    }
                                    Thread.Sleep(1000);
                                    Console.WriteLine(fecha + " Corfirmando Surrender ");
                                    for (int i = 0; i < 10; i++)
                                    {
                                        auto.MouseClick("LEFT", 1030, 490, 1, -1);
                                        Thread.Sleep(100);
                                    }
                                    //Thread.Sleep(5000);
                                    //auto.MouseClick("LEFT", 617, 428, 1, -1);
                                    //Thread.Sleep(1000);
                                    //auto.MouseClick("LEFT", 617, 428, 1, -1);
                                    Thread.Sleep(6000);
                                    auto.MouseClick("LEFT", 830, 935, 1, -1);
                                }
                                else
                                {
                                    //Confirmamos que queremos rendirnos
                                    matchings = tm.ProcessImage(ConfirmarRendirse, Captura);
                                    if (matchings[0].Similarity > 0.95f)
                                    {
                                        Console.WriteLine(fecha + " Corfirmando Surrender ");
                                        for (int i = 0; i < 10; i++)
                                        {
                                            auto.MouseClick("LEFT", 1030, 490, 1, -1);
                                            Thread.Sleep(100);
                                        }
                                        //Thread.Sleep(5000);
                                        //auto.MouseClick("LEFT", 617, 428, 1, -1);
                                        //Thread.Sleep(1000);
                                        //auto.MouseClick("LEFT", 617, 428, 1, -1);
                                        Thread.Sleep(6000);
                                        auto.MouseClick("LEFT", 830, 935, 1, -1);
                                    }
                                    else
                                    {
                                        //Confirmamos que volveremos a jugar
                                        matchings = tm.ProcessImage(VolverAJugar, Captura);
                                        //if (matchings[0].Similarity > 0.94f)
                                        if (matchings[0].Similarity > 0.91f)
                                        {
                                            Thread.Sleep(1000);
                                            Console.WriteLine(fecha + " VolverAJugar ");
                                            //auto.MouseClick("LEFT", 567, 371, 1, -1);
                                            //Thread.Sleep(1000);
                                            Cursor.Position = new Point(830, 935);
                                            auto.MouseClick("LEFT", 830, 935, 1, -1);
                                        }
                                        else
                                        {
                                            //En caso de ser eliminados sin poder tirar surrender, precionar boton salir
                                            matchings = tm.ProcessImage(Salir, Captura);
                                            if (matchings[0].Similarity > 0.90f)
                                            {
                                                Console.WriteLine(fecha + " Salir");
                                                Cursor.Position = new Point(840, 525);
                                                auto.MouseClick("LEFT", 840, 525, 1, -1);
                                                Thread.Sleep(300);
                                                auto.MouseClick("LEFT", 840, 525, 1, -1);
                                                Thread.Sleep(300);
                                                auto.MouseClick("LEFT", 840, 525, 1, -1);
                                            }
                                            else
                                            {
                                                //En caso de error en el surrender reintentar hacerlo
                                                matchings = tm.ProcessImage(ReintentandoSurrender, Captura);
                                                if (matchings[0].Similarity > 0.98f)
                                                {
                                                    Console.WriteLine(fecha + " Intentando Tirar Surrender");
                                                    for (int i = 0; i < 10; i++)
                                                    {
                                                        Cursor.Position = new Point(1905, 886);
                                                        auto.MouseClick("LEFT", 1905, 886, 1, -1);
                                                        Thread.Sleep(100);
                                                    }
                                                    for (int i = 0; i < 3; i++)
                                                    {
                                                        auto.MouseClick("LEFT", 750, 870, 1, -1);
                                                    }
                                                    Thread.Sleep(1000);
                                                    Console.WriteLine(fecha + " Corfirmando Surrender ");
                                                    for (int i = 0; i < 10; i++)
                                                    {
                                                        auto.MouseClick("LEFT", 1030, 490, 1, -1);
                                                        Thread.Sleep(100);
                                                    }
                                                    Thread.Sleep(1000);
                                                }
                                                else
                                                {
                                                    //En caso de desconexion reintentar conectar el juego
                                                    matchings = tm.ProcessImage(ErrorConexion, Captura);
                                                    if (matchings[0].Similarity > 0.96f)
                                                    {
                                                        Console.WriteLine(fecha + " Error de Conexion");
                                                        Cursor.Position = new Point(743, 444);
                                                        auto.MouseClick("LEFT", 743, 444, 1, -1);
                                                        Thread.Sleep(1000);
                                                        Console.WriteLine(fecha + " Reconectando");
                                                        auto.MouseClick("LEFT", 567, 371, 1, -1);
                                                        Thread.Sleep(100);
                                                    }
                                                    else
                                                    {
                                                        //Confirmar la reconexion
                                                        matchings = tm.ProcessImage(Reconectar, Captura);
                                                        if (matchings[0].Similarity > 0.96f)
                                                        {
                                                            Thread.Sleep(1000);
                                                            Console.WriteLine(fecha + " Reconectando");
                                                            // auto.MouseClick("LEFT", 567, 371, 1, -1);
                                                            Thread.Sleep(1000);
                                                            Cursor.Position = new Point(575, 691);
                                                            auto.MouseClick("LEFT", 575, 691, 1, -1);
                                                        }
                                                        else
                                                        {
                                                            //Ninguna de las anteriores entonces .....
                                                            Console.WriteLine(fecha + " Esperando...");
                                                            matchings = null;
                                                            GC.Collect();
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (System.ComponentModel.Win32Exception exception)
                {
                    Console.WriteLine(fecha + " Hola Soy un error :'v o eso me decia mi mama :c");
                    Console.WriteLine(fecha + " Fuera bromas tu resolucion no es la correcta lee las instrucciones");
                    Console.WriteLine(exception);
                }
                //Thread.Sleep(1500);
            }
        }
Пример #23
0
 public void Click(string ClickSide, int x, int y, int manyClick, int Speed)
 {
     auto.WinActivate("Legends of Runeterra");
     auto.MouseClick(ClickSide, x, y, manyClick, Speed);
 }
Пример #24
0
 public void mClick(string side, int x, int y, int times, int speed)
 {
     auto.MouseClick(side, x, y, times, speed);
 }