public Boolean setPort(String ip, String port) { 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]"); au3.ControlClick(hwndSTR, "", "[ID:7303]"); au3.MouseClick("LEFT", x + 11, y + 30); int indexIpPort = 0; String lastIp = ""; while (i < 15) { au3.MouseClick("RIGHT", x + 11, y + 30 + 17 * i); System.Threading.Thread.Sleep(500); au3.Send("{DOWN}"); System.Threading.Thread.Sleep(500); au3.Send("{ENTER}"); System.Threading.Thread.Sleep(500); String tmpIp = Clipboard.GetText(); if (tmpIp == lastIp) { return(false); } else { lastIp = tmpIp; } if (tmpIp.Contains(txtIp.Text)) { au3.MouseClick("RIGHT", x + 11, y + 30 + 17 * i); System.Threading.Thread.Sleep(500); au3.Send("{UP}"); System.Threading.Thread.Sleep(500); au3.Send("{ENTER}"); System.Threading.Thread.Sleep(500); au3.Send("{DOWN}"); System.Threading.Thread.Sleep(500); au3.Send("{ENTER}"); System.Threading.Thread.Sleep(500); au3.Send(port); au3.ControlClick("[ACTIVE]", "", "[ID:5675]"); return(true); } if (i == 14) { au3.MouseWheel("down", 1); } else { i++; } } return(false); }
/* public void DragAndDrop(int x, int y, int dropX, int dropY, int Delay) * { * auto.MouseClickDrag("Left", x, y, dropX, dropY, Delay); * }*/ /* public void Allin(int initialX, int initialY) * { * auto.MouseMove(initialX, initialY, -1); * auto.MouseDown("Left"); * auto.MouseMove(2439, 902, 20); * auto.MouseMove(2488, 707, 1); * auto.MouseMove(2864, 674, 1); * auto.MouseUp("Left"); * }*/ public void Wheel(string UpOrDown, int Length) { auto.WinActivate("Legends of Runeterra"); auto.MouseWheel(UpOrDown, Length); }
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 mouseScroll(string scrollDir, int scrollCount) { auto.MouseWheel(scrollDir, scrollCount); }