public static void Sleep(int nMilliseconds) { AutoItX.Sleep(nMilliseconds); }
public static void Close() { AutoItX.WinClose(MainWindowTitle); }
public static bool EnableCheating() { IntPtr hwnd = GetMainWindowHandle(); if (hwnd == IntPtr.Zero) { Console.WriteLine("failed to find cheat engine main window"); return false; } // try to close the process list dialog firstly // now try to find the dialog string processListWindowTitle = "[Title:Process List]"; int processListHandle = AutoItX.WinWait(processListWindowTitle, "", 10); IntPtr processListHwnd = IntPtr.Zero; if (processListHandle != 0) { processListHwnd = AutoItX.WinGetHandle(processListWindowTitle, ""); if (processListHwnd == IntPtr.Zero) { Console.WriteLine("failed to get handle of process list dialog"); return false; } AutoItX.WinSetState(processListHwnd, AutoItX.SW_FORCEMINIMIZE | AutoItX.SW_HIDE); } // move out mouse to avoid affect the menu item. //AutoItX.MouseMove(0, 0, 0); AutoItX.WinActivate(hwnd); AutoItX.WinWaitActive(hwnd, 10); AutoItX.Send("!f"); AutoItX.Sleep(500); AutoItX.Send("{DOWN}"); AutoItX.Sleep(500); AutoItX.Send("{DOWN}"); AutoItX.Sleep(500); AutoItX.Send("{ENTER}"); // now try to find the process list dialog processListHandle = AutoItX.WinWait(processListWindowTitle, "", 10); if (processListHandle == 0) { Console.WriteLine("failed to find process list dialog"); return false; } processListHwnd = AutoItX.WinGetHandle(processListWindowTitle, ""); if (processListHwnd == IntPtr.Zero) { Console.WriteLine("failed to get handle of process list dialog"); return false; } AutoItX.WinSetState(processListHwnd, AutoItX.SW_RESTORE | AutoItX.SW_SHOW); AutoItX.WinActivate(processListHwnd); AutoItX.WinWaitActive(processListHwnd, 10); // get the Open button IntPtr openButtonHwnd = AutoItX.ControlGetHandle(processListHwnd, "[CLASSNN:Button3]"); if (openButtonHwnd == IntPtr.Zero) { Console.WriteLine("failed to get the handle of open button"); return false; } AutoItX.ControlClick(processListHwnd, openButtonHwnd); // wait for the first confirmation dialog string confirmationDialogTitle = "Confirmation"; int confirmationHandle = AutoItX.WinWait(confirmationDialogTitle, "", 3); if (confirmationHandle == 0) { // it means the DH5_W8.exe is the same one, no change return true; } IntPtr confirmationHwnd = AutoItX.WinGetHandle(confirmationDialogTitle, ""); if (confirmationHwnd == IntPtr.Zero) { Console.WriteLine("failed to get confirmation dialog handle"); return false; } // get the No button IntPtr noButtonHwnd = AutoItX.ControlGetHandle(confirmationHwnd, "[CLASSNN:Button2]"); if (noButtonHwnd == IntPtr.Zero) { Console.WriteLine("failed to get the handle of no button"); return false; } AutoItX.ControlClick(confirmationHwnd, noButtonHwnd); AutoItX.Sleep(2000); // wait for the second confirmation dialog confirmationHandle = AutoItX.WinWait(confirmationDialogTitle, "", 3); if (confirmationHandle == 0) { Console.WriteLine("failed to wait for the second confirmation dialog"); return false; } confirmationHwnd = AutoItX.WinGetHandle(confirmationDialogTitle, ""); if (confirmationHwnd == IntPtr.Zero) { Console.WriteLine("failed to get the second confirmation dialog handle"); return false; } // get the No button IntPtr yesButtonHwnd = AutoItX.ControlGetHandle(confirmationHwnd, "[CLASSNN:Button1]"); if (noButtonHwnd == IntPtr.Zero) { Console.WriteLine("failed to get the handle of yes button"); return false; } AutoItX.ControlClick(confirmationHwnd, yesButtonHwnd); AutoItX.Sleep(1000); // now go back the main window and try to enable the script AutoItX.WinActivate(hwnd); AutoItX.WinWaitActive(hwnd, 10); IntPtr listControlHwnd = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Window11]"); if (listControlHwnd == IntPtr.Zero) { Console.WriteLine("failed to get the handle of list control"); return false; } AutoItX.ControlClick(hwnd, listControlHwnd, "LEFT", 1, 10, 7); return true; }
private void button1_Click(object sender, EventArgs e) { AutoItX.Send("{VOLUME_DOWN}"); AutoItX.Run("Notepad.exe", ""); }
public static bool isPxgActive() { return(AutoItX.WinActive(Addresses.PxgClientName) == 1 || AutoItX.WinActive(title: "PXG Bot") == 1); }
public bool Login(string host, string username, string password, int portFw, int timeOut = 20) { _lastListenPort = portFw; if (_bvssh == null || _bvssh.HasExited) { Start(); } Counter.Login++; if (Counter.Login % 50 == 0) { Kill(); Start(); Counter.Login = 1; } string btnLoginText = ""; IntPtr hwndHost = GetHandle(Controlnfo.Host), hwndUsername = GetHandle(Controlnfo.Username), hwndPassword = GetHandle(Controlnfo.Password), hwndListenPort = GetHandle(Controlnfo.ListenPort), hwndLogin = GetHandle(Controlnfo.Login); // set host SetControlText(hwndHost, host); // set username SetControlText(hwndUsername, username); // set password lock (Sync.oAutoIt) { AutoItX.ControlFocus(_bvssh.MainWindowHandle, hwndPassword); AutoItX.ControlSend(_bvssh.MainWindowHandle, hwndPassword, "{END}"); AutoItX.ControlSend(_bvssh.MainWindowHandle, hwndPassword, "+{HOME}"); AutoItX.ControlSend(_bvssh.MainWindowHandle, hwndPassword, password, 1); } // set listen port SetControlText(hwndListenPort, portFw); // click Login Click(hwndLogin); // waiting for logging int countdown = timeOut; while (countdown != 0) { status = string.Format("[{0}] Connecting {1} | {2} | {3}", countdown, host, username, password); ShowStatus(); btnLoginText = GetControlText(hwndLogin); if (btnLoginText == StringHelper.Logout || btnLoginText == StringHelper.Login) { break; } Thread.Sleep(1000); countdown--; } btnLoginText = GetControlText(hwndLogin); if (btnLoginText == StringHelper.Logout) { _connectStatus = ConnectStatus.Connected; status = string.Format("LIVE {0} | {1} | {2}", host, username, password); ShowStatus(); if (MonitorConnection) { new Thread(DisconnectChecker) { IsBackground = true } }
private void PobierzEukw(string[] kw) { if (AutoItX.WinActivate("EUKW - Prezentacja Księgi Wieczystej - Mozilla Firefox", "") == 1) { int licznik = 0; while (sprawdzZnajdz() != "Znajdź księgę wieczystą po kryteriach ") { AutoItX.Sleep(500); licznik += 1; if (licznik == 5) { licznik = 0; throw new System.Exception("ZA dlugo"); } } string numer_ksiegi = kw[1]; string cyfra_kontrolna = kw[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(700); //przesuń nad google captcha AutoItX.MouseMove(2433, 546); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(4000); int colorPixel = 0; colorPixel = AutoItX.PixelGetColor(2435, 549); while (colorPixel != 40533) { colorPixel = AutoItX.PixelGetColor(2435, 549); AutoItX.Sleep(500); licznik += 1; if (licznik == 5) { licznik = 0; DialogResult dialogResult = MessageBox.Show("Rozwiąż captche i wybierz ok", "captha do rozwiazania", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { colorPixel = 40533; } } } //wyszukaj księge AutoItX.MouseMove(2933, 685); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(6000); //sprawdzanie czy wczytala sie ksiega colorPixel = AutoItX.PixelGetColor(2527, 537); while (colorPixel == 16382457) { colorPixel = AutoItX.PixelGetColor(2527, 537); AutoItX.Sleep(500); licznik += 1; if (licznik == 15) { licznik = 0; throw new System.Exception("Za dlugo"); } } //wspolrzedne 2643,324 dla aktywnej captchy //Sprawdzamy czy KW nie jest zamknięta bool kw_zamknieta = CheckingClass.czyKwZamknieta(); if (kw_zamknieta == true) { goto KsiegaZamknieta; } //Przeglądanie aktualnej treści KW UstawPrzegladanie(); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(5000); //Czekam na wczytanie księgi colorPixel = AutoItX.PixelGetColor(1959, 123); while (colorPixel != 8554114) { colorPixel = AutoItX.PixelGetColor(1959, 123); AutoItX.Sleep(500); licznik += 1; if (licznik == 15) { licznik = 0; throw new System.Exception("Za dlugo na wczytanie księgi"); } } //Dzial III ///Sprawdz czy poprawny dzial /// AutoItX.MouseMove(2512, 219); AutoItX.MouseClick(); AutoItX.Sleep(800); while (sprawdzDzial() != "DZIAŁ III - PRAWA, ROSZCZENIA I OGRANICZENIA") { AutoItX.Sleep(800); licznik += 1; if (licznik == 15) { licznik = 0; DialogResult dialogResult = MessageBox.Show("Kliknij dzial III i wybierz OK", "DZIAL III problem", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { } } } AutoItX.Send("^u"); AutoItX.Sleep(1000); AutoItX.Send("^a"); AutoItX.Sleep(1000); AutoItX.Send("^c"); AutoItX.Sleep(800); AutoItX.Send("^{F4}"); AutoItX.Sleep(1000); dzial_III = Clipboard.GetText(); AutoItX.Sleep(1500); //DZIAL II AutoItX.MouseMove(2349, 219); AutoItX.Sleep(800); AutoItX.MouseClick(); while (sprawdzDzial() != "DZIAŁ II - WŁASNOŚĆ") { AutoItX.Sleep(800); licznik += 1; if (licznik == 15) { licznik = 0; DialogResult dialogResult = MessageBox.Show("Kliknij dzial II i wybierz OK", "DZIAL II problem", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { } else { this.Close(); } } } AutoItX.Sleep(800); AutoItX.Send("^u"); AutoItX.Sleep(800); AutoItX.Send("^a"); AutoItX.Sleep(800); AutoItX.Send("^c"); AutoItX.Sleep(800); AutoItX.Send("^{F4}"); AutoItX.Sleep(1000); dzial_II = Clipboard.GetText(); AutoItX.Sleep(1500); //DZIAL I-sp AutoItX.MouseMove(2176, 219); AutoItX.Sleep(800); AutoItX.MouseClick(); AutoItX.Sleep(800); while (sprawdzDzial() != "DZIAŁ I-SP - SPIS PRAW ZWIĄZANYCH Z WŁASNOŚCIĄ") { AutoItX.Sleep(500); licznik += 1; if (licznik == 15) { licznik = 0; DialogResult dialogResult = MessageBox.Show("Kliknij dzial I-SP i wybierz OK", "DZIAL I problem", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { } else { this.Close(); } } } AutoItX.Send("^u"); AutoItX.Sleep(800); AutoItX.Send("^a"); AutoItX.Sleep(800); AutoItX.Send("^c"); AutoItX.Sleep(800); AutoItX.Send("^{F4}"); AutoItX.Sleep(1000); dzial_Isp = Clipboard.GetText(); AutoItX.Sleep(1500); //DZIAL I-O AutoItX.MouseMove(1970, 219); AutoItX.Sleep(800); AutoItX.MouseClick(); AutoItX.Sleep(800); while (sprawdzDzial() != "DZIAŁ I-O - OZNACZENIE NIERUCHOMOŚCI") { AutoItX.Sleep(800); licznik += 1; if (licznik == 15) { licznik = 0; DialogResult dialogResult = MessageBox.Show("Kliknij dzial I-O i wybierz OK", "DZIAL I-O problem", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { } else { this.Close(); } } } AutoItX.Send("^u"); AutoItX.Sleep(800); AutoItX.Send("^a"); AutoItX.Sleep(800); AutoItX.Send("^c"); AutoItX.Sleep(800); AutoItX.Send("^c"); AutoItX.Sleep(800); AutoItX.MouseClick(); AutoItX.Send("^{F4}"); AutoItX.Sleep(1000); dzial_Io = Clipboard.GetText(); AutoItX.Sleep(1500); //Powrót do początku AutoItX.Send("{END}"); AutoItX.MouseMove(1970, 946); szukajPowrot(); /*AutoItX.Sleep(800); * AutoItX.MouseClick();*/ AutoItX.Sleep(1500); AutoItX.Send("{END}"); AutoItX.Sleep(800); AutoItX.MouseMove(2566, 577); sprawdzTlo(kolor.bialy); AutoItX.MouseMove(2662, 748); AutoItX.Sleep(800); AutoItX.MouseClick(); //Powrót do kryteriów AutoItX.Sleep(1500); AutoItX.Send("{END}"); AutoItX.MouseMove(2661, 747); AutoItX.Sleep(500); AutoItX.MouseClick(); AutoItX.Sleep(6000); 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); DodajKsiegeDoBazySQL(numerKsiegi.ToString(), dzial_III, dzial_II, dzial_Isp, dzial_Io); KsiegaZamknieta: if (kw_zamknieta == true) { string data_zamkniecia_kw = CheckingClass.DataZamknieciaKsiegi; DodajKsiegeDoBazySQL("SR2W/" + numer_ksiegi + "/" + cyfra_kontrolna, data_zamkniecia_kw, "NULL", "NULL", "NULL"); } } 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); } } }
public async static void Start() { try { while (true) { if (Enabled && Character.X != 0 && Character.HP > 0) { if (await Character.isAttacking == false && Pokemon.Reviving == false) { foreach (string monster in MonstersToAttack) { if (await Character.isAttacking) { AutoItX.Sleep(1000); } if (Enabled == false) { break; } Point res = FindMonster(monster); if (res.IsEmpty == false) { /// Found monster, so will attack it and break the foreach loop //Console.WriteLine("Monster '" + monster + "' found"); if (Settings.Debug) { Settings.DebugText += "\n Monster '" + monster + "' found"; } if (await Character.isAttacking) { break; } AutoItX.Sleep(100); bool clickResult = await ClickMonster(res); AutoItX.Sleep(150); if (clickResult) { break; } } //if (Settings.Debug) { Settings.DebugText += "\n Monster '" + monster + "' NOT found"; } //Console.WriteLine("Monster '" + monster + "' NOT found"); AutoItX.Sleep(100); } } AutoItX.Sleep(50); } else { AutoItX.Sleep(1000); } } } catch (Exception ex) { Console.WriteLine("Cavebot Attack: Start: " + ex.Message); if (Settings.Debug) { Settings.DebugText += "\n Cavebot Attack: Start: " + ex.Message; } return; } }
public override void Ejecutar() { AutoItX.Run(this.Valor, "", AutoItX.SW_NORMAL); }
public static string ControlCommand(string strTitle, string strText, string strControl, string strCommand, string strExtra) { return(AutoItX.ControlCommand(strTitle, strTitle, strControl, strCommand, strExtra)); }
public static int WinWaitClose(string strTitle, string strText = "", int nTimeout = 0) { return(AutoItX.WinWaitClose(strTitle, strText, nTimeout)); }
public static int ControlClick(string strTitle, string strText, string strControl, string strButton = "LEFT", int nNumClicks = 1, int nX = -2147483647, int nY = -2147483647) { return(AutoItX.ControlClick(strTitle, strTitle, strControl, strButton, nNumClicks, nX, nY)); }
public static int WinClose(string strTitle, string strText = "") { return(AutoItX.WinClose(strTitle, strText)); }
public static void WinActivate(string strTitle, string strText = "") { AutoItX.WinActivate(strTitle, strText); }
public int WinGetHandle(string title) { return((int)AutoItX.WinGetHandle(title)); }
internal static void MouseMove(int x, int y) { AutoItX.MouseMove(x, y); }
internal void EditShareSkill(string title, string description, string category, string subCategory, string tags, string serviceType, string locationType, string startDate, string endDate, string day, string startTime, string endTime, string skillTradeOption, string skillExchangeTag, string creditAmount, string active) { //Input Title Title.Clear(); Title.SendKeys(title); //Input Description Description.Clear(); Description.SendKeys(description); //Select Category new SelectElement(CategoryDropDown).SelectByText(category); //Select Sub-Category new SelectElement(SubCategoryDropDown).SelectByText(subCategory); //Add tag //Clear the existed tags first foreach (var removeTag in RemoveTags) { removeTag.Click(); } Tags.SendKeys(tags); Tags.SendKeys(Keys.Enter); //Select ServiceType ServiceTypeOptions.FindElement(By.XPath($"//label[text()='{serviceType}']//preceding-sibling::input")).Click(); //Select LocationType LocationTypeOptions.FindElement(By.XPath($"//label[text()='{locationType}']//preceding-sibling::input")).Click(); Thread.Sleep(3000); //Enter Startdate StartDateDropDown.SendKeys(startDate); Thread.Sleep(3000); //Enter Enddate EndDateDropDown.SendKeys(endDate); //Deselect if some days have already been selected foreach (var dayCheckbox in DaysCheckboxes) { if (dayCheckbox.Selected) { dayCheckbox.Click(); } } //Select Days Days.FindElement(By.XPath($"//label[text()='{day}']//preceding-sibling::input")).Click(); //Enter Starttime StartTime.SendKeys(startTime); //Enter Endtime EndTime.SendKeys(endTime); //Select Skilltrade option SkillTradeOptions.FindElement(By.XPath($"//label[text()='{skillTradeOption}']//preceding-sibling::input")).Click(); //Config Skilltrade according to options switch (skillTradeOption) { case "Skill-exchange": SkillExchange.SendKeys(skillExchangeTag); SkillExchange.SendKeys(Keys.Enter); break; case "Credit": CreditAmount.SendKeys(creditAmount); break; } //Clear the work sample foreach (var removeSample in RemoveSampleIcons) { removeSample.Click(); } //Upload Work Sample PlusIcon.Click(); AutoItX.WinWaitActive("Open"); AutoItX.ControlFocus("Open", "", "Edit1"); AutoItX.ControlSetText("Open", "", "Edit1", WorkSamplePath); AutoItX.ControlClick("Open", "", "Button1"); //Select Active Option ActiveOptions.FindElement(By.XPath($"//label[text()='{active}']//preceding-sibling::input")).Click(); }
internal static void HandleUploadWindow(string filePath) { AutoItX.Send(filePath); AutoItX.Send("{ENTER}"); }
public async void SaveCustomerLimitUtilisationReport( DateTime date, bool overrideExistingFile) { AutoItX.WinWait("File Download", timeout: 200); AutoItX.WinActivate("File Download"); AutoItX.Send("!s"); AutoItX.WinWait("Save As", timeout: 20); AutoItX.WinActivate("Save As"); AutoItX.Send("{DEL}"); // TODO: Make the output file name a parameter. AutoItX.Send($"CustomerLimitUtil {date:dd.MM.yyyy}.csv"); AutoItX.Send("!d"); AutoItX.Send("{DEL}"); AutoItX.Send( $"\\\\pcibtighnas1\\CBSData\\Portfolio Analysis\\Data\\Cust Util\\SBG"); AutoItX.Send("!s"); Dispatcher.Invoke((Action)(() => { _window.Logger.OkayText = $"Saving csv file..."; })); await Task.Run(() => Thread.Sleep(1000)); if (AutoItX.WinExists("Confirm Save As") != 0) { AutoItX.WinActivate("Confirm Save As"); if (overrideExistingFile) { AutoItX.Send("!y"); Dispatcher.Invoke((Action)(() => { _window.Logger.WarningText = $"Overriding existing file..."; })); } else { AutoItX.Send("!n"); Dispatcher.Invoke((Action)(() => { _window.Logger.WarningText = $"File already exists."; })); AutoItX.WinWait("Save As", timeout: 20); AutoItX.WinActivate("Save As"); AutoItX.Send("{ENTER}"); } } await Task.Run(() => Thread.Sleep(1000)); if (AutoItX.WinExists("", "Close this dialog box when download completes") != 0) { AutoItX.WinActivate("", "Close this dialog box when download completes"); AutoItX.Send("{Tab}"); AutoItX.Send("+"); while (AutoItX.WinExists("", "Close this dialog box when download completes") != 0) { await Task.Run(() => Thread.Sleep(100)); } } }
internal void EnterShareSkill() { try { //Populate the excel data GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); //Click on Share Skill button ShareSkillButton.Click(); //Enter the Title Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Enter the Description Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Choose the Category SelectElement Category = new SelectElement(CategoryDropDown); Category.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Category")); //Choose the Sub Category SelectElement SubCategory = new SelectElement(SubCategoryDropDown); SubCategory.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "SubCategory")); //Enter the tags Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); //Click the Enter button Tags.SendKeys(Keys.Enter); //Click on Service type radio button if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == ServiceTypeOptionsText1.Text) { if (!ServiceTypeOptions1.Selected) { ServiceTypeOptions1.Click(); } } else if (GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType") == ServiceTypeOptionsText2.Text) { if (!ServiceTypeOptions2.Selected) { GlobalDefinitions.wait(5000); ServiceTypeOptions2.Click(); } } //Click on Location type radio button if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == LocationTypeOptionsText1.Text) { GlobalDefinitions.wait(5000); if (!LocationTypeOptions1.Selected) { GlobalDefinitions.wait(5000); LocationTypeOptions1.Click(); } } else if (GlobalDefinitions.ExcelLib.ReadData(2, "LocationType") == LocationTypeOptionsText2.Text) { if (!LocationTypeOptions2.Selected) { GlobalDefinitions.wait(5000); LocationTypeOptions2.Click(); } } #region radio buttons //Click on Skill trade radio button if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == SkillTradeOptionText1.Text) { if (!SkillTradeOption1.Selected) { SkillTradeOption1.Click(); } //Enter the tag name in Skill exchange and press Enter key SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); //} } else if (GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade") == SkillTradeOptionText2.Text) { SkillTradeOption2.Click(); CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } //Click on Active radio buttons if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == ActiveOptionText1.Text) { if (!ActiveOption1.Selected) { ActiveOption1.Click(); } } else if (GlobalDefinitions.ExcelLib.ReadData(2, "Active") == ActiveOptionText2.Text) { ActiveOption2.Click(); } #endregion //Click on File Upload FileUpload.Click(); //Using AutoIt // AutoItx Autoit = new AutoItx(); AutoItX.WinActivate("Open"); AutoItX.Sleep(500); AutoItX.Send(@"C:\Users\anvil\Desktop\TestAnalyst.txt"); //GlobalDefinitions.wait(1200); AutoItX.Send("{ENTER}"); //StartDateDropDown.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Startdate")); GlobalDefinitions.wait(10000); Save.Click(); GlobalDefinitions.wait(10000); Assert.Pass("Successfully Service Listing is Added"); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
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) { throw; } }
static void Main(string[] args) { Console.WriteLine(@" ___ _ _ ___ _ _ _ "); Console.WriteLine(@" / __\_ _| |_| |_ ___ _ __ / __\ (_) ___| | _____ _ __ "); Console.WriteLine(@" /__\// | | | __| __/ _ \| '_ \ / / | | |/ __| |/ / _ \ '__|"); Console.WriteLine(@"/ \/ \ |_| | |_| || (_) | | | | / /___| | | (__| < __/ | "); Console.WriteLine(@"\_____/\__,_|\__|\__\___/|_| |_| \____/|_|_|\___|_|\_\___|_| "); Console.WriteLine(@" "); if (!File.Exists("config.json")) { Console.WriteLine("Unable to find config.json exiting"); Thread.Sleep(2000); return; } var settings = Settings.Get(); Console.Title = settings.Title; Console.WriteLine("All this application does is push enter on a window with the given name"); Console.WriteLine("Please dont blame me if you f**k things up with this"); Console.WriteLine("Enter window title (default: Error Applying Security)"); var windowTitle = Console.ReadLine(); if (string.IsNullOrWhiteSpace(windowTitle)) { windowTitle = settings.DefaultWindow; } Log.Info("Starting Logging Framework"); if (settings.JiggleMouse) { Log.Info("Starting mouse jiggler"); Task.Factory.StartNew(Jiggler); } for (var i = 0; i < settings.KeysSequences.Count; i++) { Console.WriteLine($"{i}: {settings.KeysSequences[i].DisplayName}"); } Console.WriteLine($"Please enter a number between 0 and {settings.KeysSequences.Count - 1}"); var position = Convert.ToInt32(Console.ReadLine()); var sequence = settings.KeysSequences[position]; while (true) { var pointer = Convert.ToBoolean(AutoItX.WinExists(windowTitle)); if (pointer) { AutoItX.WinActivate(windowTitle); AutoItX.WinWaitActive(windowTitle); Log.Info("Window Focused"); Log.Info("Commands Executing"); foreach (var command in sequence.Sequence) { AutoItX.Send(command); Thread.Sleep(15); } Log.Info("Commands Executed"); } Thread.Sleep(50); } }
public string[] GetText() { return(AutoItX.WinGetText(this.Handle, 65535).Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)); }
protected override void StopInternal() { AutoItX.ControlClick(process.MainWindowHandle, GetHandle("Button", 6)); }
private void send(string text) { AutoItX.Send(text); }
public bool Start(bool startMinimised) { Process[] processes = Process.GetProcessesByName(ExeName()); if (processes != null && processes.Length > 0) { foreach (Process process in processes) { if (process.HasExited) { continue; } try { AutoItX.WinKill(process.MainWindowHandle); } catch (Exception) { } } } try { process = Process.Start(exePath + "/" + ExeName()); } catch (Exception e) { if (Program.verboseLogging) { Console.Out.WriteLine(e); Console.Out.WriteLine(); } return(false); } if (Program.verboseLogging) { Console.Out.WriteLine($"Started {TestName()} {PID,5}, start minimised: {startMinimised}, timeout: {Timeout}"); } var end = DateTime.Now + Timeout; // Wait for process to start. while (true) { if (DateTime.Now > end) { if (Program.verboseLogging) { Console.Error.WriteLine($"Process {process.Id,5}: Failed to wait for process"); } process.Kill(); return(false); } if (process.HasExited) { if (Program.verboseLogging) { Console.Error.WriteLine($"Process {TestName()} exited before it started!"); } return(false); } if (!string.IsNullOrEmpty(process.MainWindowTitle)) { break; } Thread.Sleep(100); process.Refresh(); } Started = true; if (startMinimised) { end = DateTime.Now + Timeout; while (true) { if (DateTime.Now > end) { if (Program.verboseLogging) { Console.Error.WriteLine($"Failed to minimise {ExeName()} {PID}"); break; } } Minimised = true; if (Minimised) { break; } Thread.Sleep(500); } } return(true); }
public static void Revive(bool manual = false) { try { if (GUI.isPxgActive() == false) { AutoItX.WinActivate(Addresses.PxgClientName); } if (GUI.PokeballPosition.X == 0 || GUI.PokeballPosition.Y == 0 || GUI.PokeballPosition.IsEmpty) { if (Settings.Debug) { Settings.DebugText += "\n Pokeball position not set for reviving"; } Console.WriteLine("Pokeball position not set for reviving"); Reviving = false; return; } Reviving = true; ReviveCooldown = true; Cavebot.Enabled = false; CavebotAttack.Enabled = false; if (Settings.Debug) { Settings.DebugText += "\n Will Revive"; } ///////////////////////// if (manual || HP > 0) { PutIn(); } InputHandler.BlockUserInput(true); InputHandler.SendKeys(new string[] { AutoReviveHotkey }, 15); AutoItX.Sleep(15); InputHandler.MouseClick("left", GUI.PokeballPosition.X, GUI.PokeballPosition.Y); Settings.DebugText += "Run Revive"; AutoItX.Sleep(100); PutOut(); InputHandler.BlockUserInput(false); foreach (PokemonSpell spell in Pokemon.PokemonSpells) { spell.Available = true; } if (HP > AutoReviveHP) { Task.Run(async() => { await Task.Delay(2000); ReviveCooldown = false; }); } else { ReviveCooldown = false; } Reviving = false; Cavebot.Enabled = true; CavebotAttack.Enabled = true; } catch (Exception ex) { Console.WriteLine("Error: Revive: " + ex.Message); } }
public decimal PixelGetColor(int x, int y, int?hwnd) { return(AutoItX.PixelGetColor(x, y)); }
public void WhenIClickOnEditButtonOnShareSkillUnderManageListingPageAndEditSkillshareDetails() { //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollections(Base.ExcelPath, "ShareSkill"); GlobalDefinitions.wait(20); GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='listing-management-section']/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[8]/div/button[2]")).Click(); GlobalDefinitions.wait(20); //Title IWebElement Title = GlobalDefinitions.driver.FindElement(By.Name("title")); Title.Clear(); Title.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Title")); //Description IWebElement Description = GlobalDefinitions.driver.FindElement(By.Name("description")); Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Description")); GlobalDefinitions.wait(20); //Category IWebElement Category = GlobalDefinitions.driver.FindElement(By.Name("categoryId")); Category.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Category")); Category.Click(); //SubCategory IWebElement SubCategory = GlobalDefinitions.driver.FindElement(By.Name("subcategoryId")); SubCategory.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "SubCategory")); SubCategory.Click(); //Tags IWebElement Tags = GlobalDefinitions.driver.FindElement(By.XPath("//body/div/div/div[@id='service-listing-section']/div[contains(@class,'ui container')]/div[contains(@class,'listing')]/form[contains(@class,'ui form')]/div[contains(@class,'tooltip-target ui grid')]/div[contains(@class,'twelve wide column')]/div[contains(@class,'')]/div[contains(@class,'ReactTags__tags')]/div[contains(@class,'ReactTags__selected')]/div[contains(@class,'ReactTags__tagInput')]/input[1]")); //Remove tag GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[4]/div[2]/div/div/div/span/a")).Click(); GlobalDefinitions.wait(20); Tags.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Tags")); Tags.SendKeys(Keys.Enter); //Click on Hourly basis service or One-off service if (GlobalDefinitions.ExcelLib.ReadData(3, "Service Type") == "Hourly basis service") { //Hourly GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[1]/div/input")).Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "Service Type") == "One-off service") { //One Off GlobalDefinitions.driver.FindElement(By.XPath(" //*[@id='service-listing-section']/div[2]/div/form/div[5]/div[2]/div[1]/div[2]/div/input")).Click(); } GlobalDefinitions.wait(20); //Click on On-site or Online if (GlobalDefinitions.ExcelLib.ReadData(3, "Location Type") == "On-site") { //OnSite GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[6]/div[2]/div/div[1]/div/input")).Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "Location Type") == "Online") { //Online GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[6]/div[2]/div/div[2]/div/input")).Click(); } GlobalDefinitions.wait(60); //Click on "Today" GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div/div[1]/ul[1]/li[1]/a")).Click(); GlobalDefinitions.wait(20); //Click on "Day" GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div/div[1]/ul[2]/li[2]/a")).Click(); GlobalDefinitions.wait(20); //Click on Calendar GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div/div[1]/ul[1]/li[4]/a/span[3]")).Click(); GlobalDefinitions.wait(20); //Click on right > arrow GlobalDefinitions.driver.FindElement(By.XPath("/html/body/div[2]/div/div/div[1]/a[3]")).Click(); //Click on calendar date: 30th December 2019 GlobalDefinitions.driver.FindElement(By.XPath("/html/body/div[2]/div/div/table/tbody/tr[5]/td[2]/a")).Click(); //Click on 11:00AM IWebElement Time = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div/table/tbody/tr[2]/td[2]/div/table/tbody/tr[9]/td")); Actions action = new Actions(driver); action.MoveToElement(Time).DoubleClick().Perform(); GlobalDefinitions.wait(60); //Calendar Title IWebElement CalendarTitle = GlobalDefinitions.driver.FindElement(By.XPath("/html/body/div[4]/div[2]/div/div[2]/input")); CalendarTitle.Clear(); CalendarTitle.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "CalendarTitle")); GlobalDefinitions.wait(60); //Convert excel dateformat to C# - Enter data in Startdate string dateformat = "MM/dd/yyyy h:mm tt"; string sdate = GlobalDefinitions.ExcelLib.ReadData(3, "Startdate"); string newStartDate = DateTime.Parse(sdate).ToString(dateformat); IWebElement StartTime = GlobalDefinitions.driver.FindElement(By.XPath("/html/body/div[4]/div[2]/div/div[4]/span[1]/span/input")); StartTime.Clear(); StartTime.SendKeys(newStartDate); GlobalDefinitions.wait(120); StartTime.SendKeys(Keys.Enter); GlobalDefinitions.wait(60); //Convert excel timeformat to C# - enter data in Enddate string edate = GlobalDefinitions.ExcelLib.ReadData(3, "Enddate"); string newEndDate = DateTime.Parse(edate).ToString(dateformat); IWebElement EndTime = GlobalDefinitions.driver.FindElement(By.XPath("/html/body/div[4]/div[2]/div/div[6]/span[1]/span/input")); EndTime.Clear(); EndTime.SendKeys(newEndDate); GlobalDefinitions.wait(120); EndTime.SendKeys(Keys.Enter); //Calendar Description GlobalDefinitions.driver.FindElement(By.XPath("/html/body/div[4]/div[2]/div/div[13]/textarea")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CalendarDescription")); GlobalDefinitions.wait(60); //Save button IWebElement SaveButton = GlobalDefinitions.driver.FindElement(By.XPath("/html/body/div[4]/div[2]/div/div[16]/a[1]")); Actions builder = new Actions(Global.GlobalDefinitions.driver); builder.MoveToElement(SaveButton).Build().Perform(); WebDriverWait wait = new WebDriverWait(GlobalDefinitions.driver, TimeSpan.FromSeconds(60)); wait.Until(ExpectedConditions.ElementToBeClickable(SaveButton)); SaveButton.Click(); //Press escape button SaveButton.SendKeys(Keys.Escape); GlobalDefinitions.wait(100); IWebElement Calendar = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[7]/div/table/tbody/tr[1]/td[2]/div/div/div/div/div/div")); if (Calendar.Text == GlobalDefinitions.ExcelLib.ReadData(3, "CalendarTitle")) { var element = driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[10]/div[2]/div/div[1]/div/input")); Actions actions = new Actions(driver); actions.MoveToElement(element); actions.Perform(); //Click on Skill-exchange or Credit if (GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade") == "Skill-exchange") { GlobalDefinitions.wait(60); GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[2]/div/div[1]/div/input")).Click(); IWebElement SkillExchange = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input")); SkillExchange.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); SkillExchange.SendKeys(Keys.Enter); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "SkillTrade") == "Credit") { GlobalDefinitions.wait(60); IWebElement Credit = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[8]/div[2]/div/div[2]/div/input")); Credit.Click(); IWebElement CreditAmount = GlobalDefinitions.driver.FindElement(By.XPath("//input[contains(@name,'charge')]")); CreditAmount.SendKeys(GlobalDefinitions.ExcelLib.ReadData(3, "Credit")); } //Click on Active or Hidden if (GlobalDefinitions.ExcelLib.ReadData(3, "Active") == "Active") { GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[10]/div[2]/div/div[1]/div/input")).Click(); } else if (GlobalDefinitions.ExcelLib.ReadData(3, "Active") == "Hidden") { GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='service-listing-section']/div[2]/div/form/div[10]/div[2]/div/div[2]/div/input")).Click(); } //Upload a file IWebElement Upload = GlobalDefinitions.driver.FindElement(By.XPath("//i[@class='huge plus circle icon padding-25']")); Upload.Click(); string path = GlobalDefinitions.ExcelLib.ReadData(3, "WorkSample"); GlobalDefinitions.wait(60); AutoItX.WinWaitActive("Open"); AutoItX.Send(path); AutoItX.Send("{ENTER}"); AutoItX.Send(path); //Click Save button GlobalDefinitions.driver.FindElement(By.XPath("//input[@value='Save']")).Click(); } }
public static void Send(string strSendText, int nMode = 0) { AutoItX.Send(strSendText, nMode); }