public void GivenIAmInProfilePageAndClickChangePassword() { GlobalDefinitions.wait(50); IWebElement UsernameNavigation = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='account-profile-section']/div/div[1]/div[2]/div/span")); Actions builder = new Actions(Global.GlobalDefinitions.driver); //builder.MoveToElement(UsernameNavigation).Build().Perform(); WebDriverWait wait = new WebDriverWait(GlobalDefinitions.driver, TimeSpan.FromSeconds(60)); //wait.Until(ExpectedConditions.ElementToBeClickable(UsernameNavigation)); AutoItX.MouseMove(1700, 150); GlobalDefinitions.wait(500); UsernameNavigation.Click(); GlobalDefinitions.wait(20); IWebElement ChangePassword = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='account-profile-section']/div/div[1]/div[2]/div/span/div/a[2]")); builder.MoveToElement(ChangePassword).Build().Perform(); wait.Until(ExpectedConditions.ElementToBeClickable(ChangePassword)); ChangePassword.Click(); }
public static void Sell(int index) { Point pos = Board.GetPosition(index); AutoItX.MouseMove(pos.X, pos.Y, 15); AutoItX.Send("e"); }
/// <summary> /// Первоначальная навигация для уточнение 100 "Расчеты с бюджетом" /// </summary> public void StartNavigate() { ControlGetPos1(JournalStatusBar[0], JournalStatusBar[1], JournalStatusBar[2]); AutoItX.MouseMove(WindowsAis.X + X1 + 40, WindowsAis.Y + Y1 + 15); ControlGetPos1(WindowsAis3.Journal[0], WindowsAis3.Journal[1], WindowsAis3.Journal[2]); AutoItX.MouseClick(ButtonConstant.MouseLeft, WindowsAis.X + X1 + 30, WindowsAis.Y + Y1 + 285, 2); }
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); } }
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}"); } }
private async static Task <bool> ClickMonster(Point monsterRect) { try { if (await Character.isAttacking == false) { InputHandler.MouseClick("left", monsterRect.X + 20, monsterRect.Y + 5, keepPosition: true); AutoItX.MouseMove(GUI.ScreenGrid[7, 5].X, GUI.ScreenGrid[7, 5].Y, 3); if (await Character.isAttacking) { return(true); } else { return(false); } } return(true); } catch (Exception ex) { Console.WriteLine("Cavebot Attack: AttackMonster: " + ex.Message); if (Settings.Debug) { Settings.DebugText += "\n Cavebot Attack: AttackMonster: " + ex.Message; } return(false); } }
public static void EatFood() { if (GUI.isPxgActive() == false) { AutoItX.WinActivate(Addresses.PxgClientName); } if (Settings.Debug) { Settings.DebugText += "\n Will Eat Food"; } if (HasPokemonSet == false) { return; } if (FoodHotkey == null) { return; } InputHandler.SendKeys(new string[] { FoodHotkey }, 5); AutoItX.Sleep(50); InputHandler.MouseClick("left", GUI.BattleRect.X + 20, GUI.BattleRect.Y); AutoItX.Sleep(300); InputHandler.SendKeys(new string[] { FoodHotkey }, 5); AutoItX.Sleep(50); InputHandler.MouseClick("left", GUI.ScreenGrid[7, 5].X + (int)(GUI.sqmWidth / 2), GUI.ScreenGrid[7, 5].Y + (int)(GUI.sqmHeight / 2)); AutoItX.Sleep(30); AutoItX.MouseMove(823, 476, 1); }
public void MouseMove(int x, int y, int speed = -1) { Point point = GetMousePosition(); AutoItX.MouseMove(point.X + x, point.Y + y, speed); //autoIt.MouseMove(winWidth / 2 + winPosX + x, Convert.ToInt32(winHeight * 0.36) + winPosY + y, speed); }
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); } } }
private static void ClickBuy(int index) { AutoItX.MouseMove(600 + index * 200, 1000, 15); AutoItX.MouseDown(); AutoItX.MouseMove(AutoItX.MouseGetPos().X, AutoItX.MouseGetPos().Y - 200, 15); AutoItX.MouseUp(); Info.store[index].name = ChampionName.None; }
public void turnCornerVer3(EsoWindow esoWindow, String addrText, IntPtr processHandle, String targetCorner) { Point cursorPosition = new Point(); esoWindow.GetCursorPos(out cursorPosition); var buffer = new byte[8]; var addr = long.Parse(addrText, NumberStyles.HexNumber); IntPtr bytesRead; var result = esoWindow.ReadProcessMemory(processHandle, new IntPtr(addr), buffer, (uint)buffer.Length, out bytesRead); NumberFormatInfo nfi = new NumberFormatInfo(); nfi.NumberDecimalSeparator = ","; //Задаем запятую, как разделитель между числом и дробной частью double trgCorner = Convert.ToDouble(targetCorner, nfi); //Целевой угол double acturalCorner = BitConverter.ToDouble(buffer, 0); //текущий угол int screenX = Screen.PrimaryScreen.Bounds.Width; int numberОfTurns = 0; if (trgCorner > acturalCorner) //Целевой угол больше текущего { int X = AutoItX.MouseGetPos().X; int Y = AutoItX.MouseGetPos().Y; if (((trgCorner - acturalCorner) * 8.7184d) > (Screen.PrimaryScreen.Bounds.Width / 2)) { numberОfTurns = Convert.ToInt32(Math.Truncate(((trgCorner - acturalCorner) * 8.7184d) / (Screen.PrimaryScreen.Bounds.Width / 2))); for (int i = 0; i < numberОfTurns; i++) { AutoItX.MouseMove(X - screenX / 2 + 1, Y, 1); Thread.Sleep(50);; } result = esoWindow.ReadProcessMemory(processHandle, new IntPtr(addr), buffer, (uint)buffer.Length, out bytesRead); acturalCorner = BitConverter.ToDouble(buffer, 0); } Thread.Sleep(500); AutoItX.MouseMove(X - Convert.ToInt32((trgCorner - acturalCorner) * 8.7184d), Y, 1); //8.7184 - коэффициент, полученный эксперементальным расчетным путем } else //Целевой угол меньше текущего { int X = AutoItX.MouseGetPos().X; int Y = AutoItX.MouseGetPos().Y; if (((acturalCorner - trgCorner) * 8.7184d) > (Screen.PrimaryScreen.Bounds.Width / 2)) { numberОfTurns = Convert.ToInt32(Math.Truncate(((acturalCorner - trgCorner) * 8.7184d) / (Screen.PrimaryScreen.Bounds.Width / 2))); for (int i = 0; i < numberОfTurns; i++) { AutoItX.MouseMove(X + screenX / 2 - 1, Y, 1); Thread.Sleep(50); } result = esoWindow.ReadProcessMemory(processHandle, new IntPtr(addr), buffer, (uint)buffer.Length, out bytesRead); acturalCorner = BitConverter.ToDouble(buffer, 0); } Thread.Sleep(500); AutoItX.MouseMove(X + Convert.ToInt32((acturalCorner - trgCorner) * 8.7184d), Y, 1); //8.7184 - коэффициент, полученный эксперементальным расчетным путем } }
static void Main(string[] args) { //pega a posição do mause int x = AutoItX.MouseGetPos().X; int y = AutoItX.MouseGetPos().Y; Console.WriteLine("x"); Console.WriteLine(x.ToString()); Console.WriteLine("y"); Console.WriteLine(y.ToString()); //move o mause AutoItX.MouseMove(540, 752, 3); AutoItX.MouseClick("LEFT", 540, 752, 1); AutoItX.ProcessWait(null, 10); //AutoItX.Sleep(30000); //clica no brauser AutoItX.MouseMove(843, 56, 3); AutoItX.MouseClick("LEFT", 843, 56, 1); Console.WriteLine("esperando"); //da uma pausa AutoItX.ProcessWait(null, 3); Console.WriteLine("feito"); AutoItX.MouseMove(689, 61, 3); AutoItX.MouseClick("LEFT", 689, 61, 1); AutoItX.Send("http://www.realsis.com.br/teste"); AutoItX.ProcessWait(null, 3); AutoItX.Send("{BACKSPACE}"); AutoItX.Send("{BACKSPACE}"); AutoItX.Send("{BACKSPACE}"); AutoItX.Send("{BACKSPACE}"); AutoItX.Send("{BACKSPACE}"); AutoItX.Send("{BACKSPACE}"); AutoItX.ProcessWait(null, 3); AutoItX.Send("{ENTER}"); AutoItX.ProcessWait(null, 7); //click do mouse AutoItX.MouseClick("LEFT", 689, 61, 1); //copiar AutoItX.Send("^c"); AutoItX.ProcessWait(null, 3); //botão do windows AutoItX.Send("{LWIN}"); AutoItX.ProcessWait(null, 2); AutoItX.Send("bloco"); AutoItX.ProcessWait(null, 2); AutoItX.Send("{ENTER}"); AutoItX.ProcessWait(null, 3); //colar AutoItX.Send("^v"); }
private static Task Jiggler() { var moveBy = 1; while (true) { var point = AutoItX.MouseGetPos(); AutoItX.MouseMove(point.X + moveBy, point.Y, 0); Thread.Sleep(60000); moveBy = moveBy * -1; } }
public static void MouseClick(string button, int x, int y, int speed = 3, bool keepPosition = false) { AutoItX.WinActivate(Addresses.PxgHandle); Point oldMousePosition = Cursor.Position; AutoItX.MouseMove(x, y, speed); AutoItX.MouseDown(button); AutoItX.Sleep(15); AutoItX.MouseUp(button); if (keepPosition) { AutoItX.MouseMove(oldMousePosition.X, oldMousePosition.Y, speed); } }
private string sprawdzWynik() { AutoItX.MouseMove(2127, 329); AutoItX.MouseClick(); AutoItX.MouseClick(); AutoItX.MouseClick(); AutoItX.Send("^c"); AutoItX.MouseClick("RIGHT"); AutoItX.Sleep(500); AutoItX.MouseClick("LEFT"); string naglowek = Clipboard.GetText(); return(naglowek.TrimStart()); }
public static void PutIn() { if (isOutside() == true && PutInCooldown == false) { PutInCooldown = true; InputHandler.MouseClick("right", GUI.PokeballPosition.X, GUI.PokeballPosition.Y + 10); AutoItX.MouseMove(GUI.PokeballPosition.X - 50, GUI.PokeballPosition.Y, 1); Task.Run(async() => { await Task.Delay(1000); PutInCooldown = false; }); AutoItX.Sleep(100); } }
private string sprawdzDzial() { AutoItX.MouseMove(2492, 241); AutoItX.MouseClick("LEFT", 2492, 241, 3); AutoItX.Send("^c"); AutoItX.Sleep(400); AutoItX.MouseClick("RIGHT"); AutoItX.Sleep(400); AutoItX.MouseClick("LEFT"); string naglowek = Clipboard.GetText(); return(naglowek); }
//Wyszukuje przycisk powrót, szuka dopóki nie znajdzie koloru od tla private void szukajPowrot() { int kolorTla = 8554114; int x = 1970; int y = 946; int pobranyKolorTla = AutoItX.PixelGetColor(x, y); if (pobranyKolorTla != kolorTla) { AutoItX.MouseClick(); } else { for (int i = 0; i < 25; i += 2) { AutoItX.MouseMove(x, y -= i); //pozycja startowa int x_prawo = x; int x_lewo = x; //przesuwamy w prawo i lewo for (int j = 0; j < 6; j++) { AutoItX.MouseMove(x_prawo += j, y); int x_aktualna = AutoItX.MouseGetPos().X; int y_aktualna = AutoItX.MouseGetPos().Y; if (kolorTla != AutoItX.PixelGetColor(x_aktualna, y_aktualna)) { AutoItX.MouseClick(); break; } AutoItX.MouseMove(x_lewo -= j, y); x_aktualna = AutoItX.MouseGetPos().X; y_aktualna = AutoItX.MouseGetPos().Y; if (kolorTla != AutoItX.PixelGetColor(x_aktualna, y_aktualna)) { AutoItX.MouseClick(); break; } } } } }
public static void PutOut() { if (Pokemon.HP > 0 && Character.HP > 0) { if (isOutside() == false && PutOutCooldown == false) { InputHandler.MouseClick("right", GUI.PokeballPosition.X, GUI.PokeballPosition.Y + 10); AutoItX.Sleep(30); AutoItX.MouseMove(GUI.PokeballPosition.X - 50, GUI.PokeballPosition.Y, 1); PutOutCooldown = true; Task.Run(async() => { await Task.Delay(1000); PutOutCooldown = false; }); AutoItX.Sleep(100); } } }
public void WhenIClickOnViewForOneOfTheListingAndClickChat() { GlobalDefinitions.wait(20); GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr/td[8]/div/button[1]")).Click(); GlobalDefinitions.wait(120); IWebElement chat = GlobalDefinitions.driver.FindElement(By.XPath("//a[@href='/Home/Message/?user=5d48afb95179e8000503c1f4']")); Actions builder = new Actions(GlobalDefinitions.driver); builder.MoveToElement(chat).Build().Perform(); WebDriverWait wait = new WebDriverWait(GlobalDefinitions.driver, TimeSpan.FromSeconds(60)); wait.Until(ExpectedConditions.ElementToBeClickable(chat)); chat.Click(); GlobalDefinitions.wait(100); //driver.Navigate().Refresh(); GlobalDefinitions.wait(500); IWebElement Chatbox = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='chatTextBox']")); wait.Until(ExpectedConditions.ElementToBeClickable(Chatbox)); Chatbox.Click(); Chatbox.SendKeys("Hello"); GlobalDefinitions.wait(60); IWebElement SendButton = GlobalDefinitions.driver.FindElement(By.XPath("//button[contains(@id,'btnSend')]")); wait.Until(ExpectedConditions.ElementToBeClickable(SendButton)); AutoItX.MouseMove(1500, 800); SendButton.Click(); }
private void buttonGuessXY_Click(object sender, EventArgs e) { activate(); Rectangle rec_grid = getGridPos(); AutoItX.MouseMove(0, 0, 5); Point point_status = guessStatusPos(); mouseMove(point_status, 20); Point point_start_btn = guessStartTest_AbortTestPos(); mouseMove(point_start_btn, 20); Point point_retry = guessRetryPos(); mouseMove(point_retry, 20); }
internal static void HandleDragAndDrop(IWebElement sourceLocator, IWebElement destinationLocator, IWebDriver driver) { _action = new Actions(driver); var dest = destinationLocator.Location; AutoItX.MouseMove(150, 250, -1); AutoItX.MouseDown("LEFT"); AutoItX.MouseMove(250, 250, -1); AutoItX.MouseUp(); //_action.Click(sourceLocator) // .MoveByOffset(0, 0) // .ClickAndHold() // .MoveByOffset(250,0) // .Release() // .Build().Perform(); //_action.DragAndDrop(sourceLocator, destinatinationLocator); //_action.MoveToElement(destinatinationLocator).Build().Perform(); //_action.Release(); }
private void SearchAndSelectComboBox(IntPtr mainWindow, IntPtr searchComboBox, string value) { Rectangle mainWindowPosition = AutoItX.WinGetPos(mainWindow); Rectangle refElementPosition = AutoItX.ControlGetPos(mainWindow, searchComboBox); int startX = mainWindowPosition.X + refElementPosition.X; int startY = mainWindowPosition.Y + refElementPosition.Y; int elementPossitionX = startX + 10; int elementPossitionY = startY + 10; AutoItX.MouseMove(elementPossitionX, elementPossitionY); AutoItX.MouseClickDrag("LEFT", elementPossitionX, elementPossitionY, elementPossitionX + 100, elementPossitionY + 30, 100); AutoItX.MouseDown(); AutoItX.MouseUp(); AutoItX.ClipPut(value); AutoItX.Send("^v"); AutoItX.MouseMove(elementPossitionX + 100, elementPossitionY + 70); AutoItX.MouseDown(); AutoItX.MouseUp(); Thread.Sleep(GetRandomDelay(100)); // stop to make sure the dropdown selected done }
public static void MouseUp(MouseButtons buttons, Point location) { AutoItX.MouseMove(location.X, location.Y, 0); AutoItX.MouseUp(buttons.ToString().ToUpper()); }
public void MouseMove(int x, int y) { AutoItX.MouseMove(x, y); }
public int MouseMove(int x, int y, int speed = -1) { return(AutoItX.MouseMove(x, y, speed)); }
/// <summary> /// Выполнить макрос /// </summary> /// <param name="macros">Макрос</param> private void RunMacros(Macros macros) { foreach (Command command in macros) { //if (command.StrKey == "RightClick") //{ // if (command.SecondsPressed == 0) // { // AutoItX.MouseClick("RIGHT"); // Thread.Sleep(command.SecondsPausedAfter); // Thread.Sleep(random.Next(command.PauseRandomMin, // command.PauseRandomMax + 1)); // } // else // { // MouseControler.RightHoldXSeconds(command.SecondsPressed); // Thread.Sleep(command.SecondsPausedAfter); // Thread.Sleep(random.Next(command.PauseRandomMin, // command.PauseRandomMax + 1)); // } //} //else if (command.StrKey == "MouseMove") //{ // AutoItX.MouseMove(command.SecondsPressed, command.SecondsPausedAfter); //} //else if (command.StrKey == "LeftCick") //{ // if (command.SecondsPressed == 0) // { // AutoItX.MouseClick("LEFT"); // Thread.Sleep(command.SecondsPausedAfter); // Thread.Sleep(random.Next(command.PauseRandomMin, // command.PauseRandomMax + 1)); // } // else // { // MouseControler.LeftHoldXSeconds(command.SecondsPressed); // Thread.Sleep(command.SecondsPausedAfter); // Thread.Sleep(random.Next(command.PauseRandomMin, // command.PauseRandomMax + 1)); // } //} //else if (command.StrKey == "WheelUp") //{ // AutoItX.MouseWheel("up", random.Next(command.PressedRandomMin/ 100, command.PressedRandomMax/100)); // Thread.Sleep(command.SecondsPausedAfter); // Thread.Sleep(random.Next(command.PauseRandomMin, // command.PauseRandomMax + 1)); //} //else if (command.StrKey == "WheelDown") //{ // AutoItX.MouseWheel("down", random.Next(command.PressedRandomMin / 100, command.PressedRandomMax / 100)); // Thread.Sleep(command.SecondsPausedAfter); // Thread.Sleep(random.Next(command.PauseRandomMin, // command.PauseRandomMax + 1)); //} //ПКМ if (command.Key == 0x02) { if (command.SecondsPressed == 0) { AutoItX.MouseClick("RIGHT"); Thread.Sleep(command.SecondsPausedAfter); Thread.Sleep(random.Next(command.PauseRandomMin, command.PauseRandomMax + 1)); } else { MouseControler.RightHoldXSeconds(command.SecondsPressed); Thread.Sleep(command.SecondsPausedAfter); Thread.Sleep(random.Next(command.PauseRandomMin, command.PauseRandomMax + 1)); } } //Двинуть мышь else if (command.Key == 0x03) { AutoItX.MouseMove(command.SecondsPressed / 100, command.SecondsPausedAfter / 100, 50); } //ЛКМ else if (command.Key == 0x01) { if (command.SecondsPressed == 0) { AutoItX.MouseClick("LEFT"); Thread.Sleep(command.SecondsPausedAfter / 100); Thread.Sleep(random.Next(command.PauseRandomMin, command.PauseRandomMax + 1)); } else { MouseControler.LeftHoldXSeconds(command.SecondsPressed); Thread.Sleep(command.SecondsPausedAfter); Thread.Sleep(random.Next(command.PauseRandomMin, command.PauseRandomMax + 1)); } } else if (command.StrKey == "WheelUp") { AutoItX.MouseWheel("up", random.Next(command.PressedRandomMin / 100, command.PressedRandomMax / 100)); Thread.Sleep(command.SecondsPausedAfter); Thread.Sleep(random.Next(command.PauseRandomMin, command.PauseRandomMax + 1)); } else if (command.StrKey == "WheelDown") { AutoItX.MouseWheel("down", random.Next(command.PressedRandomMin / 100, command.PressedRandomMax / 100)); Thread.Sleep(command.SecondsPausedAfter); Thread.Sleep(random.Next(command.PauseRandomMin, command.PauseRandomMax + 1)); } else { keybd_event(command.Key /*клавиша*/, 1 /*???*/, KEYEVENTF_EXTENDEDKEY, 0); Thread.Sleep(command.SecondsPressed); Thread.Sleep(random.Next(command.PressedRandomMin, command.PressedRandomMax + 1)); keybd_event(command.Key /*клавиша*/, 1 /*???*/, KEYEVENTF_KEYUP, 0); Thread.Sleep(command.SecondsPausedAfter); Thread.Sleep(random.Next(command.PauseRandomMin, command.PauseRandomMax + 1)); } } }
void mouseMove(Point point, int speed = 0) { AutoItX.MouseMove(point.X, point.Y, speed); }
/// <summary> /// Centers the mouse on screen /// </summary> public static void CenterMouseOnScreen() { AutoItX.MouseMove(Screen.PrimaryScreen.Bounds.Width / 2, Screen.PrimaryScreen.Bounds.Height / 2); }
private void wyszukajKsiege(string _kw) { string[] separator = { @"/" }; string[] result = _kw.Split(separator, StringSplitOptions.RemoveEmptyEntries); try { if (AutoItX.WinActivate("EUKW - Prezentacja Księgi Wieczystej - Mozilla Firefox", "") == 1) { string numer_ksiegi = result[1]; string cyfra_kontrolna = result[2]; var notification = new System.Windows.Forms.NotifyIcon() { Visible = true, Icon = System.Drawing.SystemIcons.Information, BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info, BalloonTipTitle = "AutoIT - Ksiei Wieczyste", BalloonTipText = "Trwa pobieranie danych z księgi wieczystej: SR2W/" + numer_ksiegi + '/' + cyfra_kontrolna, }; notification.ShowBalloonTip(5000); //Przesuń i wpisz sąd AutoItX.MouseMove(2433, 464, 1); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Send("SR2W"); AutoItX.Send("{TAB}"); AutoItX.Sleep(500); //Wpisz numer księgi AutoItX.Send(numer_ksiegi); AutoItX.Send("{TAB}"); AutoItX.Sleep(500); //Wpisz cyfrę kontrolną AutoItX.Send(cyfra_kontrolna); AutoItX.Sleep(500); //przesuń nad google captcha AutoItX.MouseMove(2433, 546); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(4000); //wyszukaj księge AutoItX.MouseMove(2933, 685); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(6000); //Przeglądanie aktualnej treści KW AutoItX.MouseMove(2229, 797); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(5000); //Dzial III AutoItX.MouseMove(2512, 219); AutoItX.MouseClick(); AutoItX.Sleep(600); AutoItX.Send("^u"); AutoItX.Sleep(600); AutoItX.Send("^a"); AutoItX.Sleep(500); AutoItX.Send("^c"); AutoItX.Send("^{F4}"); AutoItX.Sleep(1000); dzial_III = Clipboard.GetText(); AutoItX.Sleep(500); //DZIAL II AutoItX.MouseMove(2349, 219); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(500); AutoItX.Send("^u"); AutoItX.Sleep(600); AutoItX.Send("^a"); AutoItX.Sleep(500); AutoItX.Send("^c"); AutoItX.Send("^{F4}"); AutoItX.Sleep(1000); dzial_II = Clipboard.GetText(); AutoItX.Sleep(500); //DZIAL I-sp AutoItX.MouseMove(2176, 219); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(500); AutoItX.Send("^u"); AutoItX.Sleep(600); AutoItX.Send("^a"); AutoItX.Sleep(500); AutoItX.Send("^c"); AutoItX.Send("^{F4}"); AutoItX.Sleep(1000); dzial_Isp = Clipboard.GetText(); AutoItX.Sleep(500); //DZIAL I-O AutoItX.MouseMove(1970, 219); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(500); AutoItX.Send("^u"); AutoItX.Sleep(600); AutoItX.Send("^a"); AutoItX.Sleep(500); AutoItX.Send("^c"); AutoItX.Send("^{F4}"); AutoItX.Sleep(1000); dzial_Io = Clipboard.GetText(); AutoItX.Sleep(500); //Powrót do początku AutoItX.Send("{END}"); AutoItX.MouseMove(1970, 946); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(1500); AutoItX.Send("{END}"); AutoItX.Sleep(500); AutoItX.MouseMove(2662, 748); AutoItX.Sleep(500); AutoItX.MouseClick(); richTextBox1.AppendText(dzial_III); richTextBox2.AppendText(dzial_II); richTextBox3.AppendText(dzial_Isp); richTextBox4.AppendText(dzial_Io); StringBuilder numerKsiegi = new StringBuilder(); numerKsiegi.Append("SR2W/"); numerKsiegi.Append(numer_ksiegi); numerKsiegi.Append("/"); numerKsiegi.Append(cyfra_kontrolna); dodajKsiegeDoBazy(numerKsiegi.ToString(), dzial_III, dzial_II, dzial_Isp, dzial_Io); } else { DialogResult dialogResult = MessageBox.Show("Czy uruchomić stronę EKW?", "Komunikat", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { var iPID = AutoItX.Run(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe https://przegladarka-ekw.ms.gov.pl/eukw_prz/KsiegiWieczyste/wyszukiwanieKW?komunikaty=true&kontakt=true&okienkoSerwisowe=false", "", 1); } } } catch (Exception x) { MessageBox.Show(x.ToString()); throw; } }