internal void UploadFileToWorkSample() { string FilePath = Base.WorkSampleFile; Console.WriteLine("FilePath = " + FilePath); if (GlobalDefinitions.IsWindows()) { //System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo(); //Info.FileName = GlobalDefinitions.GetCodeDirectory() + @"..\..\FileUpload.exe"; //try //{ // System.Diagnostics.Process.Start(Info); //} //catch (System.ComponentModel.Win32Exception e) //{ // Console.WriteLine("Can not find the exe", e.Message); //} //Thread.Sleep(10000); string WindowTitle = "Open"; AutoItX.WinActivate(WindowTitle, ""); AutoItX.ControlFocus(WindowTitle, "", "Edit1"); //AutoItX.ControlSetText(WindowTitle, "", "Edit1", FilePath); AutoItX.Sleep(5000); AutoItX.Send(FilePath); AutoItX.Sleep(5000); AutoItX.ControlClick(WindowTitle, "", "Button1"); Thread.Sleep(5000); } else { GlobalDefinitions.wait(5); WorSamplesFileElement.SendKeys(FilePath); GlobalDefinitions.wait(5); } }
private void FillInterBankTransInfo(IntPtr mainFormWindow, RobotContext context) { IntPtr textToAccountName = AutoItX.ControlGetHandle(mainFormWindow, "[CLASS:TCMBStyleEdit; INSTANCE:1]"); EnterTextBox(mainFormWindow, textToAccountName, context.ToAccountName); IntPtr textToAccountNumber = AutoItX.ControlGetHandle(mainFormWindow, "[CLASS:TCMBStyleEdit; INSTANCE:2]"); EnterTextBox(mainFormWindow, textToAccountNumber, context.ToAccountNumber); IntPtr transferTypeImmediate = AutoItX.ControlGetHandle(mainFormWindow, "[CLASS:TCMBStyleRadioButton; INSTANCE:1]"); //immediate AutoItX.ControlClick(mainFormWindow, transferTypeImmediate); Thread.Sleep(GetRandomDelay(100)); IntPtr searchComboBoxToBankName = AutoItX.ControlGetHandle(mainFormWindow, "[CLASS:TCMBSearchComboBox; INSTANCE:1]"); SearchAndSelectComboBox(mainFormWindow, searchComboBoxToBankName, context.ToBankName); IntPtr textTransferAmount = AutoItX.ControlGetHandle(mainFormWindow, "[CLASS:TCMBStyleEdit; INSTANCE:4]"); EnterTextBox(mainFormWindow, textTransferAmount, context.WithdrawAmount); IntPtr textPostscript = AutoItX.ControlGetHandle(mainFormWindow, "[CLASS:TCMBStyleComboBox; INSTANCE:2]"); EnterComboBoxBox(mainFormWindow, textPostscript, context.BoTransactionId); ClickButton(mainFormWindow, 350, 660); // click 'Next' button Thread.Sleep(TimeSpan.FromSeconds(2)); }
public String AddImage() { NavigateToAssetTypeSettings(); btnEditAssetTypeSettings.Click(); Thread.Sleep(3000); IWebElement element = btnAddImage; Actions actions = new Actions(PropertiesCollection.driver); actions.MoveToElement(element).Perform(); actions.ClickAndHold().Release().Perform(); string currentDir = System.IO.Directory.GetCurrentDirectory(); var configFile = currentDir.Replace("bin\\Debug", "figther aircraft.jpg"); AutoItX.WinWaitActive("Open"); AutoItX.ControlFocus("Open", "", "Edit1"); AutoItX.ControlSetText("Open", "", "Edit1", configFile); AutoItX.ControlClick("Open", "", "Button1"); Thread.Sleep(1500); btnSave.Click(); Thread.Sleep(5000); String isImageAdded = txtImage.Text; return(isImageAdded); }
private bool AuthenticateShield(string code) { if (Program.Busy) { return(false); } try { Program.Busy = true; string targetWindowClass = "[CLASS:#32770]"; string targetWindowText = "SHIELD is requesting to connect"; if (AutoItX.WinWait(targetWindowClass, targetWindowText, 1) == 0) { Program.Log("Warning: Auth window does not exist"); return(false); } AutoItX.ControlSetText(targetWindowClass, "", "[CLASS:Edit; INSTANCE:1]", code); AutoItX.ControlClick(targetWindowClass, "", "[CLASS:Button; INSTANCE:1]"); Program.Log("Auth code sent"); return(true); } catch (Exception ex) { Program.Log($"Authentication error: {ex.Message}"); return(false); } finally { Program.Busy = false; } }
public static void LogIN() { Process[] isClud = Process.GetProcessesByName("THCludSuit"); // 主目錄 // 測試"看診清單"是否有打開 if (isClud.Length == 0) { AutoItX.Run(@"C:\Program Files (x86)\THESE\杏雲醫療資訊系統\THCloudStarter.exe", @"C:\Program Files (x86)\THESE\杏雲醫療資訊系統\"); //; Wait for the Notepad to become active. The classname "Notepad" Is monitored instead of the window title AutoItX.WinWaitActive("登入畫面"); //; Now that the Notepad window Is active type some text if (AutoItX.ControlGetText("登入畫面", "", "[NAME:txtHospitalExtensionCode]") != "A") { AutoItX.ControlClick("登入畫面", "", "[NAME:txtHospitalExtensionCode]", "LEFT", 2); AutoItX.ControlSend("登入畫面", "", "[NAME:txtHospitalExtensionCode]", "A"); } AutoItX.ControlSend("登入畫面", "", "[NAME:txtPassword]", "IlovePierce4926"); AutoItX.Sleep(500); // [NAME:btnLogin] //AutoItX.ControlClick("登入畫面", "", "[NAME:picLogin]"); AutoItX.ControlClick("登入畫面", "", "[NAME:btnLogin]"); AutoItX.WinActivate("杏雲雲端醫療服務"); AutoItX.WinWaitActive("杏雲雲端醫療服務"); AutoItX.Sleep(2000); } else { AutoItX.WinActivate("杏雲雲端醫療服務"); } }
private async void button1_Click(object sender, EventArgs e) { btnCheck.Enabled = false; AutoItX.WinActivate("Comcast"); for (int i = 1; i <= CountFile; i++) { Process pr = new Process(); pr.StartInfo.FileName = "CheckLiveComcast.exe"; pr.Start(); await Task.Delay(1000); AutoItX.WinActivate("Comcast"); AutoItX.ControlSetText("Comcast", "", "[NAME:tbPath]", i.ToString()); await Task.Delay(1000); AutoItX.ControlClick("Comcast", "", "[NAME:btnStart]"); AutoItX.WinSetTitle("Comcast", "", i.ToString()); if (i % 5 == 0 || i == CountFile) { await Task.Delay(20000); killAPP(); } await Task.Delay(1000); } }
static void Main(string[] args) { if (args.Length < 1) { return; } if (!int.TryParse(args[0], out var dropDown)) { return; } new Process { StartInfo = { FileName = @"C:\Windows\System32\control.exe", Arguments = "/name Microsoft.Sound /page playback" } }.Start(); AutoItX.WinWait("Sound"); var winHandle = AutoItX.WinGetHandle("Sound"); var listView = AutoItX.ControlGetHandle(winHandle, "[CLASS:SysListView32; INSTANCE:1]"); var btnSetDefault = AutoItX.ControlGetHandle(winHandle, "[CLASS:Button; INSTANCE:2]"); var btnOk = AutoItX.ControlGetHandle(winHandle, "[CLASS:Button; INSTANCE:4]"); AutoItX.ControlFocus(winHandle, listView); AutoItX.ControlSend(winHandle, listView, "{UP}"); for (var i = 0; i < dropDown; i++) { AutoItX.ControlSend(winHandle, listView, "{DOWN}"); } AutoItX.ControlClick(winHandle, btnSetDefault); AutoItX.ControlClick(winHandle, btnOk); }
static void AdvancedExport() { string title = "高级导出"; int handle = AutoItX.WinWait(title, "", 10); if (handle == 0) { throw new InvalidOperationException("failed to find dialog for advance data exporting"); } IntPtr hwnd = AutoItX.WinGetHandle(title, ""); AutoItX.WinActivate(hwnd); IntPtr buttonAddObject = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Button5]"); IntPtr buttonBeginExport = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Button7]"); IntPtr buttonClose = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Button8]"); IntPtr comboBoxRight = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:ComboBox3]"); IntPtr buttonGenerateHeader = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Button4]"); AutoItX.ControlCommand(hwnd, buttonGenerateHeader, "Check", ""); AutoItX.ControlCommand(hwnd, comboBoxRight, "SelectString", "前复权"); AutoItX.Sleep(2000); AutoItX.ControlClick(hwnd, buttonClose); }
static void DownloadQuote() { string title = "盘后数据下载"; int handle = AutoItX.WinWait(title, "", 10); if (handle == 0) { throw new InvalidOperationException("failed to find dialog for downloading quote"); } IntPtr hwnd = AutoItX.WinGetHandle(title, ""); AutoItX.WinActivate(hwnd); // select the "日线和实时行情数据" checkbox AutoItX.Send("{SPACE}"); // click the download button IntPtr buttonDownload = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Button9]"); AutoItX.ControlClick(hwnd, buttonDownload); AutoItX.Sleep(2000); // wait until the close button is enabled. IntPtr buttonClose = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Button10]"); while (AutoItX.ControlCommand(hwnd, buttonClose, "IsEnabled", "") == "0") { AutoItX.Sleep(1000); } AutoItX.ControlClick(hwnd, buttonClose); }
static void Main(string[] args) { //IWebDriver driver = new FirefoxDriver(); //driver.Navigate().GoToUrl("http://www.google.com"); // AutoItX.Run("calc.exe", ""); //AutoItX.Sleep(5000); // AutoItX.("Calculator", "", "[CLASS:Button; INSTANCE:14]"); //AutoItX.ControlClick("Calculator", "", "139", "Left"); //AutoItX.ControlClick("Calculator", "", "135", "Left"); //AutoItX.ControlClick("Calculator", "", "94", "Left"); //AutoItX.ControlClick("Calculator", "", "132", "Left"); //AutoItX.ControlClick("Calculator", "", "121", "Left"); // Thread.Sleep(5000); //driver.Manage().Window.Maximize(); //driver.Navigate().GoToUrl("http://spreadsheetpage.com/index.php/file/C35/P10/"); //driver.FindElement(By.LinkText("smilechart.xls")).Click(); //AutoItX.WinWaitActive("Opening smilechart.xls"); //AutoItX.WinKill(); AutoItX.Run("explorer.exe d:\\", "", 1); AutoItX.WinWaitActive("Untitled"); AutoItX.Send("I'm in notepad I'm in notepad I'm in notepad I'm in notepad I'm in notepad"); AutoItX.WinClose(); Thread.Sleep(3000); AutoItX.WinWaitActive("Notepad"); AutoItX.ControlClick("Notepad", "&Save", "Button1"); }
/// <summary> /// Document checkin message click mark as complete /// </summary> public void DocumentCheckinMessgaeClickMarkAsComplete() { // Add Script for Checkin Msg // Process.Start(@"C:\Projects\AutoIT\AutoItX Scripts\CheckinScript.exe"); AutoItX.WinActivate("Mark as complete"); var winHandle = AutoItX.WinGetHandle("[REGEXPCLASS:(?i)HwndWrapper[ElementsDesktopClient.exe;;.*]]"); AutoItX.WinActivate(winHandle); AutoItX.ControlClick("Mark as complete", "", "TextBlock"); AutoItX.MouseClick("left", 1); AutoItX.MouseClick("left", 1); AutoItX.WinActivate("[REGEXPCLASS:(?i)HwndWrapper[ElementsDesktopClient.exe;;.*]]"); var winTitle = AutoItX.WinGetTitle("[REGEXPCLASS:(?i)HwndWrapper[ElementsDesktopClient.exe;;.*]]"); CommonMethods.PlayWait(3000); AutoItX.WinActivate(@"[X:1535\Y:842\W:356\H:188]"); //Click on the edc AutoItX.MouseClick(); //Select master as complete AutoItX.Send("{ENTER}"); //Move to the ok button AutoItX.Send("{TAB}"); AutoItX.Send("{TAB}"); AutoItX.Send("{TAB}"); //Click on ok button AutoItX.Send("{ENTER}"); AutoItX.MouseClick(); }
/// <summary> /// Анализ 100 Иностранцы /// </summary> /// <param name="logica">Какой анализ делаем</param> public void Status(int logica) { string status = "01"; string tp = "ТП"; switch (logica) { case 1: status = "13"; if (Inn == "ИНН:7707083893" && Kpp == "КПП:526002001") { status = "15"; } AutoItX.ControlClick(VedRazd1.Status[0], "", VedRazd1.Status[1]); AutoItX.Send(status); break; case 2: AutoItX.ControlClick(VedRazd1.SelectTp[0], "", VedRazd1.SelectTp[1]); AutoItX.Send(tp); break; case 3: AutoItX.ControlClick(VedRazd1.Status[0], "", VedRazd1.Status[1]); AutoItX.Send(status); AutoItX.ControlClick(VedRazd1.SelectTp[0], "", VedRazd1.SelectTp[1]); AutoItX.Send(tp); break; } }
public void ControlClick(string title, string text, string control) { if (wait_time > 0) { AutoItX.Sleep(wait_time); } AutoItX.ControlClick(title, text, control); }
public void Remove(string path) { //if(AutoItX.ControlTreeView(GROUPSLIST_TITLE, "", "WindowsForms10.SysTreeView32.app.0.2c908d51", "Exists", path, "") == "0") return; SelectGroup(path); AutoItX.ControlClick(GROUPSLIST_TITLE, "", "WindowsForms10.BUTTON.app.0.2c908d51"); WaitAndActivateWindow("Delete group"); AutoItX.ControlClick("Delete group", "", "WindowsForms10.BUTTON.app.0.2c908d51"); AutoItX.ControlClick("Delete group", "", "WindowsForms10.BUTTON.app.0.2c908d53"); }
// Check for terms and conditions popup and click accept button if any private void AcceptTermsandConditionPopup() { WaitForWindow(termsandConditonWindowTitle, 4); // wait for 4 secs if (AutoItX.WinExists(termsandConditonWindowTitle) == 1) { CheckControlVisibility(termsandConditonWindowTitle, acceptButton); AutoItX.ControlClick(termsandConditonWindowTitle, "", acceptButton); } }
/// <summary> /// Upload file as attachment /// </summary> /// <param name="filePath"></param> public void UploadFileAsAttachment(string filePath) { // string filePath = "\"C:\\Users\\Public\\Pictures\\Sample Pictures\\Koala.jpg\" \"C:\\Users\\Public\\Pictures\\Sample Pictures\\Hydrangeas.jpg\""; AutoItX.WinWait("[CLASS:#32770]", "", 5); AutoItX.WinWaitActive("Open"); AutoItX.ControlFocus("Open", "", "Edit1"); AutoItX.ControlSetText("Open", "", "Edit1", filePath); CommonMethods.PlayWait(3000); AutoItX.ControlClick("Open", "", "Button1"); }
public static void ClickElement(string button) { try { AutoItX.ControlClick(jabberPhoneTitle, "", button); } catch (NotFoundException ex) { Console.WriteLine("Element can not clickable : " + button); Console.WriteLine("Class AutoItXCiscoJabber | Method ClickElement | Exception desc : " + ex.Message); } }
public static void uploadFileUsingAutoIT(string fileName) { FileUploadPath = Path.Combine(solutionParentDirectory, fileName); Console.WriteLine("File upload path: " + FileUploadPath); // Upload file //AutoIt autoIt = new AutoIt(); AutoItX.WinWait("Open"); AutoItX.WinActivate("Open"); AutoItX.WinWaitActive("Open"); AutoItX.ControlFocus("Open", "", "Edit1"); AutoItX.ControlSetText("Open", "", "Edit1", FileUploadPath); AutoItX.ControlClick("Open", "", "Button1"); }
public void Save(string path, string filename) { AutoItX.MouseClick("LEFT", 20, 30, 1); //клик по "Файл" AutoItX.MouseClick("LEFT", 42, 213, 1); //клик по "Сохранить как" AutoItX.MouseClick("LEFT", 515, 80, 1); //клик по "Сохранить как PNG" AutoItX.Sleep(1000); AutoItX.WinWaitActive("Сохранение"); AutoItX.Send(filename); AutoItX.Sleep(1000); AutoItX.ControlClick("Сохранение", "", "ToolbarWindow324"); //выделение контрола пути AutoItX.Send(path + "{ENTER}"); //набор пути и клац о клавишу Enter AutoItX.ControlClick("Сохранение", "", "Button2"); //клик по кнопке "сохранить" AutoItX.WinWaitActive(filename); }
private void LoginUsingUserCredentials() { WaitForWindow(loginWindowTitle); //Check all elements are visible in this particular window CheckControlVisibility(loginWindowTitle, usernameTextbox); CheckControlVisibility(loginWindowTitle, passwordTextbox); CheckControlVisibility(loginWindowTitle, okButton); CheckforGroupSelector(loginWindowTitle, groupDropdown); AutoItX.ControlSetText(loginWindowTitle, "", usernameTextbox, userName); AutoItX.ControlSetText(loginWindowTitle, "", passwordTextbox, passWord); AutoItX.ControlClick(loginWindowTitle, "", okButton); }
private void CheckForCertificationErrorPopup() { //Wait for certification error popup. This is optional because all domains wont have certificate errors WaitForWindow(certificationWindowTitle, 8, certificationWindowText); if (AutoItX.WinExists(certificationWindowTitle, "Untrusted Server Blocked!") == 1) { CheckControlVisibility(certificationWindowTitle, keepMeSafeButton, "Keep Me Safe"); ShowErrorPopup("Fix certification issue and rerun the script.."); } else if (AutoItX.WinExists(certificationWindowTitle, certificationWindowText) == 1) { CheckControlVisibility(certificationWindowTitle, connectAnywayButton); AutoItX.ControlClick(certificationWindowTitle, "", connectAnywayButton); } }
private RobotResult DoGetBalance(RobotContext context) { try { IntPtr mainFormWindow = GetMainFormWindow(); AutoItX.WinActivate(mainFormWindow); ClickButton(mainFormWindow, 50, 80); // click HomePage button Thread.Sleep(TimeSpan.FromSeconds(3)); // sleep wait for [CLASS:Internet Explorer_Server] load done ClickButton(mainFormWindow, 230, 480); // click Statement button Thread.Sleep(TimeSpan.FromSeconds(5)); // sleep wait for [CLASS:Internet Explorer_Server] load done ClickButton(mainFormWindow, 1580, 390); // click Download button WaitUtils.UntilWinActive("[TITLE:File Download; CLASS:#32770]", ""); AutoItX.WinActivate("[TITLE:File Download; CLASS:#32770]", ""); Thread.Sleep(TimeSpan.FromSeconds(1)); AutoItX.ControlClick("[TITLE:File Download; CLASS:#32770]", "", "[CLASS:Button; INSTANCE:2]"); // click Save button WaitUtils.UntilWinActive("[TITLE:Save As; CLASS:#32770]", ""); ChangeDownloadPath($@"{StatementBaseFolder}\{context.FromAccountNumber}"); Thread.Sleep(TimeSpan.FromSeconds(1)); AutoItX.ControlClick("[TITLE:Save As; CLASS:#32770]", "", "[CLASS:Button; INSTANCE:2]"); // click Save button int warningHappen1 = AutoItX.WinWaitActive("[TITLE:Confirm Save As; CLASS:#32770]", "", 2); if (warningHappen1 == AutoItXSuccess) { AutoItX.WinActivate("[TITLE:Confirm Save As; CLASS:#32770]", ""); Thread.Sleep(TimeSpan.FromSeconds(1)); AutoItX.ControlClick("[TITLE:Confirm Save As; CLASS:#32770]", "", "[CLASS:Button; INSTANCE:1]"); // click Yes button } WaitUtils.UntilWinActive("[TITLE:Download complete; CLASS:#32770]", ""); AutoItX.WinActivate("[TITLE:Download complete; CLASS:#32770]", ""); Thread.Sleep(TimeSpan.FromSeconds(1)); AutoItX.ControlClick("[TITLE:Download complete; CLASS:#32770]", "", "[CLASS:Button; INSTANCE:4]"); // click Close button Thread.Sleep(TimeSpan.FromSeconds(2)); return(RobotResult.Build(context, RobotStatus.SUCCESS, "")); } catch (Exception e) { return(RobotResult.Build(context, RobotStatus.ERROR, e.Message)); } }
public void WindowsWarningOrConfirmationDismiss(string alertTitle) { try { if (AutoItX.WinExists(alertTitle) != 0) { AutoItX.WinWaitActive(alertTitle); AutoItX.ControlClick(alertTitle, "", "[CLASS:Button; INSTANCE:1; TEXT:&No]"); AutoItX.WinWaitClose(alertTitle); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void HandleFileUploadWindow(string filepath) { try { string windowTitle = GetBrowserName() == "internet explorer" ? "Choose File to Upload" : "Open"; AutoItX.WinWait(windowTitle, "File &name:", 10); AutoItX.ControlSetText(windowTitle, "", "[CLASS:Edit; INSTANCE:1]", filepath); AutoItX.ControlClick(windowTitle, "", "[CLASS:Button; INSTANCE:1]"); AutoItX.WinWaitClose(windowTitle, "File &name:", 10); } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Созданный блок для автоматизации Создание заявки на формирование СНУ ФЛ /// Ветка Налоговое администрирование\Физические лица\1.06. Формирование и печать CНУ\1. Создание заявки на формирование СНУ для единичной печати /// </summary> public void Click1(string pathjurnalerror, string pathjurnalok, string inn) { while (true) { WindowsAis3 win = new WindowsAis3(); win.ControlGetPos1(WindowsAis3.WinRequest[0], WindowsAis3.WinRequest[1], WindowsAis3.WinRequest[2]); AutoItX.MouseClick(ButtonConstant.MouseLeft, win.WindowsAis.X + win.X1 + 180, win.WindowsAis.Y + win.Y1 + 120); AutoItX.WinWait(WindowsAis3.Text, WindowsAis3.WinWait, 3); if (AutoItX.WinExists(WindowsAis3.Text, WindowsAis3.WinWait) == 1) { break; } } AutoItX.Sleep(1000); AutoItX.WinActivate(WindowsAis3.Text, WindowsAis3.WinWait); AutoItX.ClipPut(inn); AutoItX.Send(ButtonConstant.Down2); AutoItX.Send(ButtonConstant.Right5); AutoItX.Send(ButtonConstant.Enter); AutoItX.Send(ButtonConstant.CtrlV); AutoItX.ControlClick(WindowsAis3.Text, SnuForm.ButUpdate[0], SnuForm.ButUpdate[1], ButtonConstant.MouseLeft); AutoItX.Sleep(3000); while (true) { if (AutoItX.WinExists(WindowsAis3.Text, WindowsAis3.DataNotFound) == 1) { AutoItX.ControlClick(WindowsAis3.Text, SnuForm.ButCancel[0], SnuForm.ButCancel[1], ButtonConstant.MouseLeft); LibaryXMLAuto.ErrorJurnal.ErrorJurnal.JurnalError(pathjurnalerror, inn, ModeBranch, WindowsAis3.DataNotFound); break; } if (AutoItX.WinExists(WindowsAis3.Text, WindowsAis3.UpdateDataSource) == 1) { AutoItX.Send(ButtonConstant.CtrlA); AutoItX.ControlClick(WindowsAis3.Text, SnuForm.ButNext[0], SnuForm.ButNext[1], ButtonConstant.MouseLeft); AutoItX.WinActivate(WindowsAis3.AisNalog3, WindowsAis3.Text); AutoItX.ControlClick(WindowsAis3.AisNalog3, SnuForm.ButCreateZ[0], SnuForm.ButCreateZ[1], ButtonConstant.MouseLeft); AutoItX.WinWait(SnuText.DialogWin); AutoItX.WinActivate(SnuText.DialogWin); AutoItX.Send(ButtonConstant.Enter); LibaryXMLAuto.ErrorJurnal.OkJurnal.JurnalOk(pathjurnalok, inn, "Отработали"); break; } } }
protected override bool SetTimingInternal(Timing timing, string value) { IntPtr hwnd = GetHandle("ComboBox", GetInstance(timing)); if (hwnd == IntPtr.Zero) { return(false); } AutoItX.WinActivate(process.MainWindowHandle); AutoItX.ControlClick(process.MainWindowHandle, hwnd); AutoItX.ControlSend(process.MainWindowHandle, hwnd, "{BACKSPACE}"); Thread.Sleep(50); foreach (var character in value.ToCharArray()) { AutoItX.ControlSend(process.MainWindowHandle, hwnd, $"{character}", 1); Thread.Sleep(20); } return(true); }
/// <summary> /// Edit And Save Word Document the opened word document /// </summary> /// <param name="RegistryEntryTitle"></param> /// <param name="editText"></param> public void EditAndSaveWordDocument(string RegistryEntryTitle, string editText = "Edit document") { //Running .exe files hence using Explicitly wait CommonMethods.PlayWait(10000); AutoItX.WinWait(RegistryEntryTitle + " - Word", "", 10); //Activate - So that next set of actions happen on this window AutoItX.WinActivate(RegistryEntryTitle + " - Word", ""); AutoItX.WinActivate("[CLASS:OpusApp]", ""); //Set input focus to the edit control of Upload window using the handle returned by WinWait AutoItX.ControlClick(RegistryEntryTitle + " - Word", "", "_WwG1"); AutoItX.Send("!+{SPACE}", 0); AutoItX.Send("x", 0); AutoItX.Send("{ENTER}"); AutoItX.Send(editText); AutoItX.Send("^s"); }
/// <summary> /// Stops the recording. /// </summary> public void StopRecording() { Logger.Debug("Stop Recording"); lock (_syncObj) { if (!_isRecording) { return; } _isRecording = false; AutoItX.AutoItSetOption("WinTitleMatchMode", 2); AutoItX.WinActivate(ObsWindowTitle); AutoItX.ControlClick(ObsWindowTitle, "", ObsStartStopButtonId, "LEFT", 1, ObsStartStopButtonXPos, ObsStartStopButtonYPos); } }
public static void RunClient(string ipadress, string country, int port) { int icheck = 0; Process[] processlist = Process.GetProcesses(); foreach (Process process in processlist) { string tile = process.MainWindowTitle; if (!String.IsNullOrEmpty(tile)) { if (tile.ToLower().Contains("911 S5 3.26")) { icheck = 1; } } } Task t = new Task(() => { if (icheck == 0) { CmdProcess("./ChangeProxy/", "Client.exe"); Thread.Sleep(7000); AutoItX.WinActivate("911 S5 3.26", ""); AutoItX.ControlClick("911 S5 3.26", "", "[CLASS:ThunderRT6CommandButton; INSTANCE:4]"); Thread.Sleep(7000); AutoItX.WinClose("Annoucement"); Thread.Sleep(3000); Change(country, port); DeviceConnect dv = new DeviceConnect(); string ipPC = getIPAddrees(); dv.SetProxy(ipadress, ipPC, port, true); } else { Change(country, port); } }); t.Start(); }
static void ExportDataAction() { string title = "数据导出"; int handle = AutoItX.WinWait(title, "", 10); if (handle == 0) { throw new InvalidOperationException("failed to find dialog for data exporting"); } IntPtr hwnd = AutoItX.WinGetHandle(title, ""); AutoItX.WinActivate(hwnd); IntPtr buttonAdvancedExport = AutoItX.ControlGetHandle(hwnd, "[CLASSNN:Button6]"); AutoItX.ControlClick(hwnd, buttonAdvancedExport); AdvancedExport(); }