void ScrollDown() { Point startpoint = new Point(951, 12); Point endPoint = new Point(952, 202); IntPtr hWnd = IntPtr.Zero; hWnd = AutoControl.FindWindowHandle(null, "Garena - Game Center"); var child = AutoControl.FindHandle(hWnd, "Chrome_RenderWidgetHostHWND", null); var spoint = AutoControl.GetGlobalPoint(child, startpoint); var endP = AutoControl.GetGlobalPoint(child, endPoint); int[] arrEndPoint = { 202, 315, 341, 358, 432, 471, 500, 570, 630 }; AutoControl.BringToFront(hWnd); AutoItX3Lib.AutoItX3 autoItX = new AutoItX3(); autoItX.MouseMove(spoint.X, spoint.Y); autoItX.MouseDown("LEFT"); autoItX.MouseMove(endP.X, endP.Y); autoItX.MouseUp("LEFT"); }
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); } }
public void ClickLeft() { auto.MouseDown("LEFT"); auto.MouseUp("LEFT"); }