Exemple #1
0
        private void btnClick_Click(object sender, EventArgs e)
        {
            int x = (int)numericUpDown1.Value;
            int y = (int)numericUpDown2.Value;

            EMouseKey mousekey = new EMouseKey();

            if (cbRightMouse.Checked)
            {
                if (cbDoubleClick.Checked)
                {
                    mousekey = EMouseKey.DOUBLE_RIGHT;
                }
                else
                {
                    mousekey = EMouseKey.RIGHT;
                }
            }
            else
            {
                if (cbDoubleClick.Checked)
                {
                    mousekey = EMouseKey.DOUBLE_LEFT;
                }
                else
                {
                    mousekey = EMouseKey.LEFT;
                }
            }

            //Cursor.Position = new Point(x, y);
            AutoControl.MouseClick(x, y, mousekey);
        }
Exemple #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            int x = (int)numericUpDown1.Value;
            int y = (int)numericUpDown2.Value;

            EMouseKey mouseKey = EMouseKey.LEFT;

            if (checkBox1.Checked)
            {
                if (checkBox2.Checked)
                {
                    mouseKey = EMouseKey.DOUBLE_RIGHT;
                }
                else
                {
                    mouseKey = EMouseKey.RIGHT;
                }
            }
            else
            {
                if (checkBox2.Checked)
                {
                    mouseKey = EMouseKey.DOUBLE_LEFT;
                }
            }

            //Cursor.Position = new Point(x,y);

            AutoControl.MouseClick(x, y, mouseKey);
        }
Exemple #3
0
        public void LoginTranS()
        {
            string strCmdText;
            string userName = Environment.UserName;

            strCmdText = @"/C C:\Users\" + userName + @"\AppData\Roaming\TranS\TranS.exe";

            Process p = new Process();

            p.StartInfo.FileName  = "CMD.exe";
            p.StartInfo.Arguments = strCmdText;

            p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

            p.Start();
            Thread.Sleep(4000);

            //click Student
            var screen = CaptureHelper.CaptureScreen();

            screen.Save("mainScreen.png");
            var subBitmap = ImageScanOpenCV.GetImage("btnHocVien.bmp");
            var resBitmap = ImageScanOpenCV.FindOutPoint((Bitmap)screen, subBitmap);

            if (resBitmap != null)
            {
                string x = (resBitmap.ToString()).Remove(0, 3).Remove(3, 7);
                string y = (resBitmap.ToString()).Remove(0, 9).Remove(3, 1);
                AutoControl.MouseClick(int.Parse(x) + 20, int.Parse(y) + 20, EMouseKey.LEFT);
            }

            Thread.Sleep(500);

            //Send Enter ID
            try
            {
                AutoControl.SendStringFocus(txtBoxID.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Bạn chưa nhập ID");
            }


            //Click Join now
            var screenID = CaptureHelper.CaptureScreen();

            screenID.Save("mainScreen.png");
            var subBitmapID = ImageScanOpenCV.GetImage("btnVaoPhong.bmp");
            var resBitmapID = ImageScanOpenCV.FindOutPoint((Bitmap)screenID, subBitmapID);

            if (resBitmapID != null)
            {
                string x1 = (resBitmapID.ToString()).Remove(0, 3).Remove(3, 7);
                string y1 = (resBitmapID.ToString()).Remove(0, 9).Remove(3, 1);
                AutoControl.MouseClick(int.Parse(x1) + 20, int.Parse(y1) + 20, EMouseKey.LEFT);
            }
            Application.Exit();
        }
Exemple #4
0
        private void button5_Click(object sender, EventArgs e)
        {
            int x = (int)trucX.Value;
            int y = (int)trucY.Value;

            //Cursor.Position = new Point(x, y);
            AutoControl.MouseClick(x, y, EMouseKey.LEFT);
        }
Exemple #5
0
        private void button5_Click(object sender, EventArgs e)
        {
            AutoItX3 autoItX3    = new AutoItX3();
            Point    LOLlocation = new Point(805, 175);
            IntPtr   hWnd        = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, "Garena - Game Center");
            var child = AutoControl.FindHandle(hWnd, "Chrome_RenderWidgetHostHWND", null);
            var point = AutoControl.GetGlobalPoint(child, LOLlocation);
            int num   = Convert.ToInt32(textBox1.Text);

            AutoControl.BringToFront(hWnd);
            AutoControl.MouseClick(point);
            Thread.Sleep(3000);
            var belowdiendan      = new Point(425, 4);
            var pointBelowdiendan = (Point)AutoControl.GetGlobalPoint(child, belowdiendan);

            pointBelowdiendan.Y -= 20;
            AutoControl.MouseClick(pointBelowdiendan);
            Thread.Sleep(3000);
            Point writebutton     = new Point(774, 578);
            var   WritePostButton = (Point)AutoControl.GetGlobalPoint(child, writebutton);

            //autoItX3.MouseMove(WritePostButton)
            AutoControl.MouseClick(WritePostButton);
            Thread.Sleep(2000);
            var title = (Point)AutoControl.GetGlobalPoint(child, 172, 221);

            AutoControl.MouseClick(title);
            autoItX3.Send("some trash title i can put in");
            Thread.Sleep(1000);
            var content = (Point)AutoControl.GetGlobalPoint(child, 170, 269);

            AutoControl.MouseClick(content);
            autoItX3.Send("test");
            Thread.Sleep(1000);
            var uploadImage = (Point)AutoControl.GetGlobalPoint(child, 178, 493);

            AutoControl.MouseClick(uploadImage);
            Thread.Sleep(2000);
            //Thread. Sleep and send key like someimage.png;
            autoItX3.Send("Normal.png");
            Thread.Sleep(1000);
            AutoControl.SendKeyPress(KeyCode.ENTER);
            Thread.Sleep(2000);
            var link = (Point)AutoControl.GetGlobalPoint(child, 232, 535);

            AutoControl.MouseClick(link);
            var linkloc = (Point)AutoControl.GetGlobalPoint(child, 186, 560);

            AutoControl.MouseClick(linkloc);
            autoItX3.Send("https://www.youtube.com/watch?v=HKS6cp5OGMo&list=RDzhqvxdx8kIM&index=2");
            var Send = (Point)AutoControl.GetGlobalPoint(child, 772, 516);

            AutoControl.MouseClick(Send);
            // done
        }
Exemple #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle("Notepad", null);
            var child = AutoControl.FindHandle(hWnd, "edit", null);

            AutoControl.BringToFront(hWnd);
            AutoControl.MouseClick(400, 400);
            Thread.Sleep(300);

            mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -720, (UIntPtr)0);
        }
Exemple #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            int    x    = 947;
            int    y    = 118;
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, "Garena - Game Center");
            var child = AutoControl.FindHandle(hWnd, "Chrome_RenderWidgetHostHWND", null);
            var point = AutoControl.GetGlobalPoint(child, x, y);

            AutoControl.BringToFront(hWnd);
            AutoControl.MouseClick(AutoControl.GetGlobalPoint(child, 10, 10));
            mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -720, (UIntPtr)0);
            AutoControl.Click();
            //AutoControl.SendKeyDown()
        }
        private void button8_Click(object sender, EventArgs e)
        {
            int x = (int)numericUpDown1.Value;
            int y = (int)numericUpDown2.Value;

            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, textBox1.Text);

            var childhWnd = IntPtr.Zero;

            // Tìm ra handle con mà thỏa điều kiện text và class y chang
            //childhWnd = AutoControl.FindWindowExFromParent(hWnd, null, textBox2.Text);

            //Tìm ra handle con mà thỏa text hoặc class giống
            childhWnd = AutoControl.FindHandle(hWnd, textBox2.Text, textBox2.Text);

            // lấy ra tọa độ trên màn hình của tọa độ bên trong cửa sổ
            var pointToClick = AutoControl.GetGlobalPoint(childhWnd, x, y);

            EMouseKey mouseKey = EMouseKey.LEFT;

            if (checkBox1.Checked)
            {
                if (checkBox2.Checked)
                {
                    mouseKey = EMouseKey.DOUBLE_RIGHT;
                }
                else
                {
                    mouseKey = EMouseKey.RIGHT;
                }
            }
            else
            {
                if (checkBox2.Checked)
                {
                    mouseKey = EMouseKey.DOUBLE_LEFT;
                }
            }

            AutoControl.BringToFront(hWnd);

            AutoControl.MouseClick(pointToClick, mouseKey);
        }
Exemple #9
0
        private void btnFo4_Click_1(object sender, EventArgs e)
        {
            FO4.StartInfo.FileName = "E:\\FileDesktop\\FOT4";
            FO4.Start();
            FO4.StartInfo.FileName = "E:\\FileDesktop\\Garena";
            FO4.Start();
            FO4.WaitForInputIdle();


            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(tbClickApp.Text, null);

            var pointToClick = AutoControl.GetGlobalPoint(hWnd, 600, 430);



            EMouseKey mousekey = EMouseKey.LEFT;

            if (cbRightMouse.Checked)
            {
                if (cbDoubleClick.Checked)
                {
                    mousekey = EMouseKey.DOUBLE_RIGHT;
                }
                else
                {
                    mousekey = EMouseKey.RIGHT;
                }
            }
            else
            {
                if (cbDoubleClick.Checked)
                {
                    mousekey = EMouseKey.DOUBLE_LEFT;
                }
            }


            AutoControl.BringToFront(hWnd);
            //Cursor.Position = new Point(x, y);
            AutoControl.MouseClick(pointToClick, mousekey);
        }
Exemple #10
0
        private void btnClickControlApp_Click(object sender, EventArgs e)
        {
            int x = (Int32)pointCursorX.Value;
            int y = (Int32)pointCursorY.Value;

            //var hWnd = Process.GetProcessById(3652).MainWindowHandle;

            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, txtApplicationName.Text.Trim());


            var childWnd = IntPtr.Zero;

            childWnd = AutoControl.FindHandle(hWnd, txtClass.Text, txtClass.Text);

            var pointToClick = AutoControl.GetGlobalPoint(childWnd, x, y);

            EMouseKey eMouseKey = EMouseKey.LEFT;

            if (chkMouseRightClick.Checked)
            {
                if (chkMouseDoubleClick.Checked)
                {
                    eMouseKey = EMouseKey.DOUBLE_RIGHT;
                }
                else
                {
                    eMouseKey = EMouseKey.RIGHT;
                }
            }
            else
            {
                if (chkMouseDoubleClick.Checked)
                {
                    eMouseKey = EMouseKey.DOUBLE_LEFT;
                }
            }
            AutoControl.BringToFront(hWnd);

            AutoControl.MouseClick(pointToClick, eMouseKey);
        }
Exemple #11
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            var screen = CaptureHelper.CaptureScreen();

            screen.Save("mainScreen.png");
            var subBit         = ImageScanOpenCV.GetImage("commentSection.PNG");
            var sendpost       = ImageScanOpenCV.GetImage("SendComment.PNG");
            var ComsecLocation = ImageScanOpenCV.FindOutPoint((Bitmap)screen, subBit);

            AutoControl.MouseClick((Point)ComsecLocation);
            //autoItX3.Send("Hello");
            Thread.Sleep(1000);
            screen = CaptureHelper.CaptureScreen();
            var   sendLocation = ImageScanOpenCV.FindOutPoint((Bitmap)screen, sendpost);
            Point sendlo       = (Point)sendLocation;

            sendlo.X += 3;
            sendlo.Y += 7;
            AutoControl.MouseClick((Point)sendlo);
        }
Exemple #12
0
        private void button7_Click(object sender, EventArgs e)
        {
            try
            {
                int x = (int)numericUpDown1.Value;
                int y = (int)numericUpDown2.Value;

                Point pointToClick = new Point(x, y);

                EMouseKey key    = EMouseKey.LEFT;
                IntPtr    handle = IntPtr.Zero;
                if (textBox3.Text != null && textBox4.Text != null)
                {
                    handle       = AutoControl.FindWindowHandle(textBox4.Text, textBox3.Text);
                    pointToClick = AutoControl.GetGlobalPoint(handle, x, y);
                }
                if (checkBox1.Checked)
                {
                    key = EMouseKey.RIGHT;
                }
                else
                {
                    key = EMouseKey.DOUBLE_RIGHT;
                }

                if (checkBox2.Checked)
                {
                    key = EMouseKey.LEFT;
                }
                else
                {
                    key = EMouseKey.DOUBLE_LEFT;
                }
                AutoControl.BringToFront(handle);
                AutoControl.MouseClick(pointToClick, key);
            }
            catch (Exception)
            {
                MessageBox.Show("Error!");
            }
        }
Exemple #13
0
        private void button7_Click(object sender, EventArgs e)
        {
            int x = (int)numericUpDown1.Value;
            int y = (int)numericUpDown2.Value;

            //var hWnd = Process.GetProcessById(12012).MainWindowHandle;
            //var hWnd = Process.GetProcessesByName("Remote Desktop Connection")[0].MainWindowHandle;
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, textBox1.Text);

            // lấy ra tọa độ trên màn hình của tọa độ bên trong cửa sổ. Use Autoit window info
            var pointToClick = AutoControl.GetGlobalPoint(hWnd, x, y);

            EMouseKey mouseKey = EMouseKey.LEFT;

            if (checkBox1.Checked)
            {
                if (checkBox2.Checked)
                {
                    mouseKey = EMouseKey.DOUBLE_RIGHT;
                }
                else
                {
                    mouseKey = EMouseKey.RIGHT;
                }
            }
            else
            {
                if (checkBox2.Checked)
                {
                    mouseKey = EMouseKey.DOUBLE_LEFT;
                }
            }

            AutoControl.BringToFront(hWnd);

            // Cursor.Position = new Point(x, y);
            AutoControl.MouseClick(pointToClick, mouseKey);
        }
Exemple #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            int    x    = (int)numericUpDown1.Value;
            int    y    = (int)numericUpDown2.Value;
            IntPtr hWnd = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(tbClickApp.Text, null);

            var pointToClick = AutoControl.GetGlobalPoint(hWnd, x, y);



            EMouseKey mousekey = EMouseKey.LEFT;

            if (cbRightMouse.Checked)
            {
                if (cbDoubleClick.Checked)
                {
                    mousekey = EMouseKey.DOUBLE_RIGHT;
                }
                else
                {
                    mousekey = EMouseKey.RIGHT;
                }
            }
            else
            {
                if (cbDoubleClick.Checked)
                {
                    mousekey = EMouseKey.DOUBLE_LEFT;
                }
            }


            AutoControl.BringToFront(hWnd);
            //Cursor.Position = new Point(x, y);
            AutoControl.MouseClick(pointToClick, mousekey);
        }
Exemple #15
0
        private void button18_Click(object sender, EventArgs e)
        {
            var handle = AutoControl.FindWindowHandle("LDMultiPlayerMainFrame" == "" ? null : "LDMultiPlayerMainFrame", "" == "" ? null : "");

            #region // khởi tạo và restore file backup


            #endregion

            #region // ấn nút bắt đầu
            var sub   = (Bitmap)Bitmap.FromFile("data//data.png");
            var main  = (Bitmap)CaptureHelper.CaptureWindow(handle);
            var point = ImageScanOpenCV.FindOutPoint(main, sub);
            if (point != null)
            {
                //   AutoControl.SendClickOnPosition(handle, point.Value.X, point.Value.Y);
                var       pointToClick = AutoControl.GetGlobalPoint(handle, point.Value.X + 7, point.Value.Y + 5);
                EMouseKey mouseKey     = EMouseKey.DOUBLE_LEFT;
                AutoControl.BringToFront(handle);
                AutoControl.MouseClick(pointToClick, mouseKey);
            }
            #endregion
        }
Exemple #16
0
        private void button6_Click(object sender, EventArgs e)
        {
            IntPtr @int = AutoControl.FindWindowHandle("Microsoft Visual Studio ", null);

            int x            = (int)trucX.Value;
            int y            = (int)trucY.Value;
            var pointToClick = AutoControl.GetGlobalPoint(@int, x, y);

            AutoControl.BringToFront(@int);
            AutoControl.MouseClick(pointToClick);

            MessageBox.Show(@int.ToString());


            //var aaa = Process.GetProcessesByName("devenv").FirstOrDefault();
            //if (aaa != null)
            //{
            //    aaa.Kill();
            //}
            //else
            //{
            //    Process.Start("devenv");
            //}
        }
Exemple #17
0
        private void button4_Click(object sender, EventArgs e)
        {
            AutoItX3 autoItX3    = new AutoItX3();
            Point    LOLlocation = new Point(805, 175);
            IntPtr   hWnd        = IntPtr.Zero;

            hWnd = AutoControl.FindWindowHandle(null, "Garena - Game Center");
            var child = AutoControl.FindHandle(hWnd, "Chrome_RenderWidgetHostHWND", null);
            var point = AutoControl.GetGlobalPoint(child, LOLlocation);
            int num   = Convert.ToInt32(textBox1.Text);

            AutoControl.BringToFront(hWnd);
            AutoControl.MouseClick(point);
            Thread.Sleep(3000);
            autoItX3.MouseWheel("down", 2);
            Thread.Sleep(3000);
            //var postPoint = AutoControl.GetGlobalPoint(child, 147, 113);// 147 113
            //AutoControl.MouseClick(postPoint);
            //Thread.Sleep(2000);
            int[] arrEndPoint = { 202, 315, 341, 358, 432, 471, 500, 570, 630 }; // for y
            for (int i = 0; i < 2; i++)
            {
                Point startpoint = new Point(951, 12);
                Point endPoint   = new Point(952, 202);
                var   fpoint     = AutoControl.GetGlobalPoint(child, 150, 149);
                for (int j = 0; j < 3; j++)
                {
                    AutoControl.MouseClick(fpoint);
                    Thread.Sleep(3000);
                    var spoint = AutoControl.GetGlobalPoint(child, startpoint);
                    autoItX3.MouseMove(spoint.X, spoint.Y);
                    autoItX3.MouseDown("LEFT");
                    Bitmap screen;
                    for (int p = 0; p < arrEndPoint.Length; p++)
                    {
                        endPoint.Y = arrEndPoint[p];
                        var endP = AutoControl.GetGlobalPoint(child, endPoint);
                        autoItX3.MouseMove(endP.X, endP.Y);
                        screen = (Bitmap)CaptureHelper.CaptureScreen();
                        var subBit         = ImageScanOpenCV.GetImage("commentSection.PNG");
                        var sendpost       = ImageScanOpenCV.GetImage("SendComment.PNG");
                        var ComsecLocation = ImageScanOpenCV.FindOutPoint((Bitmap)screen, subBit);
                        if (ComsecLocation != null)
                        {
                            autoItX3.MouseUp("LEFT");
                            AutoControl.MouseClick((Point)ComsecLocation);
                            autoItX3.Send("Hello");
                            Thread.Sleep(1000);
                            screen = (Bitmap)CaptureHelper.CaptureScreen();
                            var   sendLocation = ImageScanOpenCV.FindOutPoint((Bitmap)screen, sendpost);
                            Point sendlo       = (Point)sendLocation; // can not find  the right so find the near and add a few unit to right point
                            sendlo.X += 3;
                            sendlo.Y += 7;
                            AutoControl.MouseClick((Point)sendlo);
                            screen.Dispose();
                            break;
                        }
                    }
                    var exitpost = AutoControl.GetGlobalPoint(child, 62, 6);
                    exitpost.Y -= 37;
                    AutoControl.MouseClick(exitpost);
                    Thread.Sleep(2000);
                    fpoint.X += 325;
                }
                Thread.Sleep(1000);
                Point zone = AutoControl.GetGlobalPoint(child, 20, 20);
                autoItX3.MouseMove(zone.X, zone.Y);
                autoItX3.MouseWheel("down", 4);
                Thread.Sleep(3000);
            }
        }
Exemple #18
0
        void runChrome()
        {
            if (isRunning)
            {
                for (int i = 1; i <= 9999; i++)
                {
                    if (isRunning)
                    {
                        for (int rows = 0; rows < dataGridView1.Rows.Count; rows++)
                        {
                            if (isRunning)
                            {
                                IPHostEntry ip;
                                while (isRunning)
                                {
                                    var check = false;
                                    dataGridView1.Rows[rows].Cells[1].Value = "Change IP";
                                    runCMD("rasdial viettel");
                                    string myip = "";
                                    ip = Dns.GetHostEntry(Dns.GetHostName());
                                    foreach (IPAddress ipa in ip.AddressList)
                                    {
                                        if (ipa.AddressFamily == AddressFamily.InterNetwork)
                                        {
                                            myip = ipa.ToString();
                                        }
                                    }

                                    if (File.Exists("ListIP.txt"))
                                    {
                                        dataGridView1.Rows[rows].Cells[1].Value = "Check duplicate IP";
                                        string[] listIP = File.ReadAllLines("ListIP.txt");
                                        foreach (var item in listIP)
                                        {
                                            var temp = item.Split(':');
                                            if (myip == temp[0].Trim())
                                            {
                                                check = true;
                                            }
                                        }
                                    }
                                    if (!check)
                                    {
                                        File.AppendAllText("ListIP.txt", myip + " : " + dataGridView1.Rows[rows].Cells[0].Value + "\n");
                                        dataGridView1.Rows[rows].Cells[1].Value = "Open Chrome";
                                        Process.Start(dataGridView1.Rows[rows].Cells[0].Value.ToString());
                                        break;
                                    }
                                    else
                                    {
                                        runCMD("rasdial /disconnect");
                                    }
                                }

                                if (isRunning)
                                {
                                    Thread.Sleep(2500);
                                    var cap = CaptureHelper.CaptureScreen();
                                    cap.Save("res.png");
                                    var sub   = ImageScanOpenCV.GetImage("icon.PNG");
                                    var count = 0;
                                    while (count <= 30)
                                    {
                                        Point?res = ImageScanOpenCV.FindOutPoint((Bitmap)cap, sub);
                                        if (res != null)
                                        {
                                            AutoControl.MouseClick(res.Value.X, res.Value.Y, EMouseKey.LEFT);
                                            Thread.Sleep(time * 1000);
                                            break;
                                        }
                                        count++;
                                    }
                                }
                                runCMD("taskkill /f /im chrome.exe");
                                dataGridView1.Rows[rows].Cells[1].Value = "Disconnect Dcom";
                                runCMD("rasdial /disconnect");
                                if (isRunning)
                                {
                                    dataGridView1.Rows[rows].Cells[1].Value = "Done";
                                }
                                else
                                {
                                    dataGridView1.Rows[rows].Cells[1].Value = "Stop";
                                }
                            }
                            else
                            {
                                dataGridView1.Rows[rows].Cells[1].Value = "Stop";
                            }
                        }
                    }
                }
            }
        }
Exemple #19
0
 public void hma()
 {
     Process.Start(@textBox2.Text);
     Thread.Sleep(1000);
     AutoControl.MouseClick(int.Parse(textBox3.Text), int.Parse(textBox4.Text));
 }