private void OpenExcelClient(IWebElement excelDoc) { AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Microsoft Excel - " + currentdocTitle); autoit.WinWaitActive("Microsoft Excel - " + currentdocTitle, "", 20); Thread.Sleep(2000); autoit.ControlSend("Microsoft Excel - " + currentdocTitle, currentdocTitle, "EXCEL71", "{DOWN}"); Thread.Sleep(1000); autoit.ControlSend("Microsoft Excel - " + currentdocTitle, currentdocTitle, "EXCEL71", "Adding this line from Word Desktop Client At: " + DateTime.Now); }
private void OpenWordClient(IWebElement doc) { AutoItX3 autoit = new AutoItX3(); autoit.WinActivate(currentdocTitle + " - Microsoft Word"); autoit.WinWaitActive(currentdocTitle + " - Microsoft Word", "", 20); Thread.Sleep(2000); autoit.ControlSend(currentdocTitle + " - Microsoft Word", "Microsoft Word Document", "_WwG1", "{ENTER}"); Thread.Sleep(1000); autoit.ControlSend(currentdocTitle + " - Microsoft Word", "Microsoft Word Document", "_WwG1", "{UP}"); Thread.Sleep(1000); autoit.ControlSend(currentdocTitle + " - Microsoft Word", "Microsoft Word Document", "_WwG1", "Adding this line from Word Desktop Client At: " + DateTime.Now); }
public void loadFile(string filepath) { //дефолт расчитанный на firefox string titlewindow = "Выгрузка файла"; string labelcontrol = "Имя файла:"; if (pages.browsername == "chrome") { titlewindow = "Открытие"; labelcontrol = "Имя файла:"; } if (pages.browsername == "firefox") { titlewindow = "Выгрузка файла"; labelcontrol = "Имя файла:"; } List <int> logs = new List <int>(); AutoItX3 autoIt = new AutoItX3(); logs.Add(autoIt.WinWait(titlewindow, "", 10)); logs.Add(autoIt.ControlSetText(titlewindow, labelcontrol, "", filepath)); Console.WriteLine("новый лог:" + autoIt.WinGetTitle(titlewindow)); autoIt.WinActivate(titlewindow); logs.Add(autoIt.ControlSend(titlewindow, "", "", "{ENTER}")); Console.WriteLine("==============вывод ошибок========"); foreach (int temp in logs) { Console.WriteLine(temp); } Console.WriteLine("==============конец вывода========"); }
private void btnStart_Click(object sender, EventArgs e) { //GeckoPreferences.User["network.proxy.type"] = 1; //GeckoPreferences.User["network.proxy.socks"] = "127.0.0.1"; //GeckoPreferences.User["network.proxy.socks_port"] = 9951; //GeckoPreferences.User["network.proxy.socks_version"] = 5; // GeckoPreferences.User["network.proxy.socks_remote_dns"] = true; // GeckoPreferences.User["media.peerconnection.enabled"] = false; //GeckoPreferences.User["network.http.max-connections"] = 32; //GeckoPreferences.User["network.http.max-persistent-connections-per-proxy"] = 16; AutoItX3 au3 = new AutoItX3(); int hwnd1 = au3.Run(@"C:\Users\longthanh\Downloads\Compressed\vip72socks\vip72socks.exe"); au3.WinWaitActive("[TITLE:VIP72 Socks Client]", "", 10); String hWnd = au3.WinGetHandle("[TITLE:VIP72 Socks Client]"); String hwndSTR = "[HANDLE:" + hWnd.ToString() + "]"; // int hWnd = au3.WinWait("[TITLE:VIP72 Socks Client]", "", 10); int tmp = au3.ControlClick(hwndSTR, "", "[ID:119]"); waitText(au3, hwndSTR, "[ID:131]", "System ready", "ERROR", 30); //click select country au3.ControlClick(hwndSTR, "", "[ID:7811]"); waitText(au3, hwndSTR, "[ID:131]", "Total proxies online", "ERROR", 30); //click Country au3.ControlClick(hwndSTR, "", "[ID:7809]", "left", 2, 11, 58); //click select Region au3.ControlClick(hwndSTR, "", "[ID:7813]"); System.Threading.Thread.Sleep(2000); //click Region au3.ControlClick(hwndSTR, "", "[ID:7809]", "left", 2, 11, 50); //click search au3.ControlClick(hwndSTR, "", "[ID:127]"); waitText(au3, hwndSTR, "[ID:131]", new String[] { "Only", "Ok" }, "ERROR", 30); au3.ControlClick(hwndSTR, "", "[ID:116]", "right", 1, 57, 35); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{ENTER}"); System.Threading.Thread.Sleep(10); String s = Clipboard.GetText(); au3.ControlClick(hwndSTR, "", "[ID:116]", "right", 1, 57, 35); System.Threading.Thread.Sleep(1); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{ENTER}"); Boolean checkNotBlackist = waitText(au3, "[ACTIVE]", "[ID:33]", "is NOT black", "is BLACKLISTED", 30); au3.ControlClick("[ACTIVE]", "", "[ID:99]"); MessageBox.Show("Login Success: " + s + " " + checkNotBlackist); // webBrowser1.Navigate("youtube.com"); }
private void buttonAppServer_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("CMD.exe", "/C mstsc"); AutoItX3 a = new AutoItX3(); a.WinWaitActive("Remote Desktop Connection"); a.ControlSend("Remote Desktop Connection", "", "[CLASS:Edit; INSTANCE:1]", "{LSHIFT}" + appserver.Text.ToString() + ".usmlvv1d0a.smshsc.net"); a.ControlClick("Remote Desktop Connection", "", "[CLASS:Button; INSTANCE:5]"); } catch (Exception e3) { buttonAppServer.Text = "Try Again"; } }
public void clearAllProxy() { au3.WinSetOnTop(hwndSTR, "", 1); int x = au3.WinGetPosX(hwndSTR, "") + 8; int y = au3.WinGetPosY(hwndSTR, "") + 30; x += au3.ControlGetPosX(hwndSTR, "", "[ID:117]"); y += au3.ControlGetPosY(hwndSTR, "", "[ID:117]"); au3.ControlClick(hwndSTR, "", "[ID:7303]"); au3.MouseClick("LEFT", x + 11, y + 30); for (int i = 0; i < 50; i++) { au3.ControlSend(hwndSTR, "", "[ID:117]", "{DEL}"); } au3.WinSetOnTop(hwndSTR, "", 0); }
private void clearProxy_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(3000); AutoItX3 au3 = new AutoItX3(); String hWnd = au3.WinGetHandle("[TITLE:VIP72 Socks Client]"); au3.MouseMove(0, 0); String hwndSTR = "[HANDLE:" + hWnd.ToString() + "]"; au3.WinSetOnTop(hwndSTR, "", 1); au3.ControlClick(hwndSTR, "", "[ID:7303]"); au3.ControlClick(hwndSTR, "", "[ID:117]", "menu", 1, 57, 35); //System.Threading.Thread.Sleep(2000); au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{ENTER}"); System.Threading.Thread.Sleep(2000); }
public void controlsend(string title, string all) { auto.ControlSend(title, "", "", all); }
public static bool EditExcelFile() { OpenDocument(true); autoit.WinActivate("Microsoft Excel - " + currentWorkingDocTitle); if ((autoit.WinWaitActive("Microsoft Excel - " + currentWorkingDocTitle, "", 20)) == 1) { Thread.Sleep(2000); autoit.ControlSend("Microsoft Excel - " + currentWorkingDocTitle, "IT Metrics", "EXCEL71", "{DOWN}"); Thread.Sleep(1000); autoit.ControlSend("Microsoft Excel - " + currentWorkingDocTitle, "IT Metrics", "EXCEL71", "Adding this line from Excel 2010 Desktop Client At: " + DateTime.Now); Thread.Sleep(2000); return(true); } else { Console.WriteLine("AutoIT was unable to find the Excel document Window for editing"); return(false); } }
/// <summary> /// The entry point, or main thread / main loop, of our program /// </summary> public static void test() { au3 = new AutoItX3(); //initialize our au3 class library au3.AutoItSetOption("WinTitleMatchMode", 4); //advanced window matching thread = new Thread(new ThreadStart(threadtest)); //initialize and start our thread thread.Start(); if (au3.WinExists("Névtelen - Jegyzettömb", "") == 0) //if an Untitled - Notepad document doesn't exist au3.Run(@"C:\WINDOWS\SYSTEM32\notepad.exe", "", au3.SW_SHOW); //run notepad else au3.WinActivate("Névtelen - Jegyzettömb", ""); //otherwise activate the window string hWnd = ""; //let's use a window handle while (hWnd.Length == 0) //try to get a handle to notepad until it succeeds hWnd = au3.WinGetHandle("Névtelen - Jegyzettömb", ""); while (au3.WinActive("handle=" + hWnd, "") == 0) //loop while it's not active { au3.WinActivate("handle=" + hWnd, ""); //and activate it Thread.Sleep(100); } while (au3.WinExists("handle=" + hWnd, "") != 0) //while the window exists, loop { //send our incrementing variable, i, to notepad, with a trailing | au3.ControlSend("handle=" + hWnd, "", "Edit1", i.ToString() + "|", 0); i++; //increment i Thread.Sleep(100); //short sleep so we don't burn CPU } //if the while loop exited--because there's no Untitled - Notepad--make the other thread stop executing threadshouldexecute = false; Console.Write("Press [ENTER] to continue..."); //tell the user to press ENTER to quit Console.ReadLine(); //pause until enter is pressed }
public static void play(string title, int x, int y, string value) { //au3.ControlClick("[TITLE:Đua Thú - Game kiếm tiền triệu phú - Google Chrome; CLASS:Chrome_WidgetWin_1]", "", "", "LEFT", 2, 195, 602); au3.ControlClick(title, "", "", "LEFT", 2, x, y); au3.ControlSend(title, "", "", value, 0); }