public static void sendSpace() { SendKeys.SendWait("{SPACE}"); }
private void txtTelefone_TextChanged(object sender, EventArgs e) { txtTelefone.Text = Funcoes.Formata_TelefoneFixo(txtTelefone.Text); SendKeys.SendWait("{END}"); }
//TODO: Currently we are iterating and clicking over a tab width to locate a tab. This adds unnecessary click events. Fix it to avoid additional click public void SendKeysByLibrary(AutomationElement element, string value) { element.SetFocus(); SendKeys.SendWait(value); }
public static void SendKey(int keyCode, Setting setting) { if (keyCode == (int)Keys.NumPad1) { for (var i = 1; i <= 2; i++) { SendKeys.SendWait(i.ToString()); SendKeys.Flush(); Clicker.LeftClick(Cursor.Position.X, Cursor.Position.Y, setting.CompressDelay); SendKeys.Flush(); } } if (keyCode == (int)Keys.Add) { Clicker.RightClick(30); var temp = Cursor.Position; int x = 50; SendKeys.Send("2"); Thread.Sleep(20); Clicker.LeftClick(180, 705, setting.DelayS); Thread.Sleep(x + 30); SendKeys.Send("1"); Thread.Sleep(20); Clicker.LeftClick(180, 705, setting.DelayS); Thread.Sleep(x + 20); MouseOperations.SetCursorPosition(temp.X, temp.Y); Thread.Sleep(x + 10); Clicker.RightClick(20); } if (keyCode == (int)Keys.NumPad5) { ShortcutManager.CtrlWith(Keys.N, setting.DelayS); } if (keyCode == (int)Keys.N) { ShortcutManager.CtrlWith(Keys.N, setting.DelayS); } if (keyCode == (int)Keys.G) { ShortcutManager.CtrlWith(Keys.G, setting.DelayS); } if (keyCode == (int)Keys.M) { ShortcutManager.CtrlWith(Keys.M, setting.DelayS); } if (keyCode == (int)Keys.H) { ShortcutManager.CtrlWith(Keys.H, setting.DelayS); } if (keyCode == (int)Keys.B) { ShortcutManager.CtrlWith(Keys.B, setting.DelayS); } if (keyCode == (int)Keys.I) { ShortcutManager.CtrlWith(Keys.I, setting.DelayS); } if (keyCode == (int)Keys.E) { var pos = Cursor.Position; Clicker.LeftClick(pos.X, pos.Y, setting.DelayS); Clicker.LeftClick(586, 707, setting.DelayS); MouseOperations.SetCursorPosition(pos.X, pos.Y); } if (keyCode == (int)Keys.S) { MoveDirection.Direction(Keys.Down, setting.Direction); } if (keyCode == (int)Keys.W) { MoveDirection.Direction(Keys.Up, setting.Direction); } if (keyCode == (int)Keys.A) { MoveDirection.Direction(Keys.Left, setting.Direction); } if (keyCode == (int)Keys.D) { MoveDirection.Direction(Keys.Right, setting.Direction); } if (keyCode == (int)Keys.Q) { var corner = new List <Point>() { new Point(159, 732), new Point(192, 730), new Point(162, 760), new Point(192, 759), }; var p = Pip.PointInPolygan(corner).FirstOrDefault(); var current = new Point(Cursor.Position.X, Cursor.Position.Y); Clicker.LeftClick(10); MouseMoves.LinearSmoothMove(p, setting.MouseSpeed); Clicker.LeftClick(10); MouseMoves.LinearSmoothMove(current, setting.MouseSpeed); } //if (keyCode == (int)Keys.W) //{ // var p1 = Cursor.Position; // int dddd = 100; // Clicker.LeftClick(p1.X, p1.Y, delayNumber + dddd); // Clicker.LeftClick((p1.X - 63), (p1.Y - 33), delayNumber + dddd); // Clicker.LeftClick((p1.X + 66), (p1.Y - 33), delayNumber + dddd); // Clicker.LeftClick((p1.X), (p1.Y - 66), delayNumber + dddd); //} }
public static void ClosePrintWindow() { SendKeys.SendWait("{ESC}"); }
private void timerClose_Tick(object sender, EventArgs e) { SendKeys.SendWait("{Enter}"); timerClose.Enabled = false; this.txtCard.Text = string.Empty; }
static void SendWakeup() { System.Threading.Thread.Sleep(60000); // time in ms SendKeys.SendWait("{NUMLOCK}"); }
private void button_Click(object sender, RoutedEventArgs e) { SendKeys.Send("Q"); SendKeys.SendWait("Q"); }
private void NodeTypeCombo_SelectedIndexChanged(object sender, EventArgs e) { SendKeys.SendWait("{ESC}"); //hack na ztratu focusu }
private void btnDate_Click(object sender, EventArgs e) { dtpDate.Focus(); SendKeys.SendWait("%{DOWN}"); }
public void Handler(string data) { string[] split = data.Split('&'); if (split.Length > 1) { string type = split[0]; string action = split[1]; switch (type) { case "cmd": if (action == "EXIT") { Environment.Exit(1); } else if (action == "TOGGLE") { display = display == 1 ? 0 : 1; ShowWindow(ConsoleWindow, display); } else if (action == "LOCK") { if (!Lock) { Lock = true; LockPC(); } else { Lock = false; } } else { action = action.Replace("\n", "&"); Process process = new Process(); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = true; startInfo.FileName = "CMD.exe"; startInfo.Arguments = "/C " + action; process.StartInfo = startInfo; process.Start(); string output = process.StandardOutput.ReadToEnd(); Console.WriteLine(output); Send("b&" + output); process.WaitForExit(); } break; case "mm": int deltaX = int.Parse(action); int deltaY = int.Parse(split[2]); int x = (Cursor.Position.X + deltaX); int y = (Cursor.Position.Y + deltaY); Cursor.Position = new Point(x, y); /* int fps = (int)((DateTime.Now - lastTime).TotalMilliseconds); * lastTime = DateTime.Now; * Console.WriteLine(fps);*/ break; case "mc": int click = (action == "left" ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_RIGHTDOWN); mouse_event(click, Cursor.Position.X, Cursor.Position.Y, 0, 0); break; case "me": int unclick = (action == "left" ? MOUSEEVENTF_LEFTUP : MOUSEEVENTF_RIGHTUP); mouse_event(unclick, Cursor.Position.X, Cursor.Position.Y, 0, 0); break; case "mw": int movement = int.Parse(action); mouse_event(MOUSEEVENTF_WHEEL, 0, 0, movement, 0); break; case "ky": string key = action; SendKeys.SendWait(action); break; } } }
static void Main(string[] args) { string serialNumber = "0000000000"; string serialNumber2 = "0000000001"; byte[] dataRead = new byte[8]; // Will contain card's Serial Number AKA UID byte[] tagType = new byte[50]; byte ResultTag = 0; if (!Program_Initialize()) // Program_Initialize returns False. Exit program. Possible permission issue. { Exit_Program(); } Reader_Initialize(); Program_Delay(); for (; ;) { /* Slow down reader read operation based on polling rate since there's no reason to have it run fast continually */ Thread.Sleep(Int32.Parse(config.pollingRate)); status = ACR120U.ACR120_Select(hReader, ref tagType[0], ref ResultTag, ref dataRead[0]); // Read operation if (status == 0) // 0 = No error/successful { serialNumber = "0000000000"; serialNumber = ByteArrayToString(dataRead).Substring(0, 8); if (config.organizationChoice == UTEM) // UTEM uses numbers only. Convert from Hex to Int { serialNumber = Convert.ToString(Int64.Parse(serialNumber, System.Globalization.NumberStyles.HexNumber)); } Console.WriteLine("Serial Number: " + serialNumber); /* Checks if the card being read is the same. If yes, no need to continually send input */ if (string.Equals(serialNumber2, serialNumber)) { continue; } else { SendKeys.SendWait(serialNumber.Trim()); serialNumber2 = serialNumber; } } /* No card is detected by the reader. Sets both serial number variables to 00000000 as a reset procedure */ else if (status == 62536) { serialNumber = "0000000000"; serialNumber2 = "0000000000"; Console.WriteLine("Serial Number: " + serialNumber); continue; } /* TODO: Error handling? */ else { continue; } } }
/*****/ } /******/ /*****/ /******/ //****************************************************************************************/ //***************************************************************************************/ //static void Zebra(string File, string Amount) static void Zebra(string File, string ExcFile, int daudzums) { // OPEN LABEL // Process Label = Process.Start(@"C:\temp\" + File); Thread.Sleep(7000); // SEARCH HANDLES & CHECK OK FOR PRINTERS // const int BN_CLICKED = 245; IntPtr ZebraDesigner = FindWindow(null, "Design"); IntPtr ChoosePrinterDialog = FindWindowEx(ZebraDesigner, IntPtr.Zero, "#32770", "Select Printer"); IntPtr ButtonOK = FindWindowEx(ChoosePrinterDialog, IntPtr.Zero, "Button", "OK"); SendMessage((IntPtr)ButtonOK, BN_CLICKED, 0, IntPtr.Zero); Thread.Sleep(1000); // LOOP THROUGHT EXCEL FILE string curr = Directory.GetCurrentDirectory(); FileInfo fileName = new FileInfo(@"C:\temp\" + ExcFile); ExcelPackage pck = new ExcelPackage(fileName); var ws = pck.Workbook.Worksheets["Sheet1"]; var row = 2; var acol = 2; var bcol = 3; for (row = 2; row <= daudzums; row++) { if (ws.Cells[row, acol].Value == null) { goto end; } //Double mouse left click on program center Cursor.Position = new System.Drawing.Point(800, 550); SendMouseDoubleClick(); Thread.Sleep(1000); // edit text IntPtr TextWizzard = FindWindowEx(ZebraDesigner, IntPtr.Zero, "#32770", "Text Wizard"); //IntPtr Cont = FindWindowEx(TextWizzard, IntPtr.Zero, "Button", "&Content"); //IntPtr Text = FindWindowEx(TextWizzard, IntPtr.Zero, "Edit", "I002-2"); //Message(Text, 0x000C, IntPtr.Zero, new StringBuilder("Hello World!")); Thread.Sleep(1000); for (int i = 1; i <= 10; i++) { SendKeys.SendWait("{DEL}"); } Thread.Sleep(1000); SendKeys.SendWait(ws.Cells[row, acol].Value.ToString()); Thread.Sleep(500); IntPtr ButtonFinish = FindWindowEx(TextWizzard, IntPtr.Zero, "Button", "&Finish"); SendMessage((IntPtr)ButtonFinish, BN_CLICKED, 0, IntPtr.Zero); Thread.Sleep(500); Cursor.Position = new System.Drawing.Point(1400, 550); SendMouseDoubleClick(); Thread.Sleep(1000); for (int i = 1; i <= 5; i++) { SendKeys.SendWait("{DEL}"); } Thread.Sleep(1000); SendKeys.SendWait(ws.Cells[row, bcol].Value.ToString()); Thread.Sleep(500); IntPtr BarCodeWizard = FindWindowEx(ZebraDesigner, IntPtr.Zero, "#32770", "Bar Code Wizard"); IntPtr ButtonFinish2 = FindWindowEx(BarCodeWizard, IntPtr.Zero, "Button", "&Finish"); SendMessage((IntPtr)ButtonFinish2, BN_CLICKED, 0, IntPtr.Zero); // SHORTCUT TO PRINTING // SendKeys.SendWait("^(p)"); Thread.Sleep(1000); // EDIT AMOUNT // IntPtr PrintDialog = FindWindowEx(ZebraDesigner, IntPtr.Zero, "#32770", "Print"); IntPtr ChnageAmount = FindWindowEx(PrintDialog, IntPtr.Zero, "Edit", null); SendKeys.SendWait("1"); Thread.Sleep(1000); // CHECKBOXES // const int BM_SETCHECK = 0x00f1; const int BST_CHECKED = 0x0001; const int BST_UNCHECKED = 0x0000; IntPtr PrintToFile = FindWindowEx(PrintDialog, IntPtr.Zero, "Button", "Print to &file"); IntPtr CloseAfterPrint = FindWindowEx(PrintDialog, IntPtr.Zero, "Button", "Close after &print"); SendMessage(PrintToFile, BM_SETCHECK, BST_UNCHECKED, IntPtr.Zero); SendMessage(CloseAfterPrint, BM_SETCHECK, BST_CHECKED, IntPtr.Zero); Thread.Sleep(1000); // PRINT // // IntPtr Print = FindWindowEx(PrintDialog, IntPtr.Zero, "Button", "Print"); IntPtr Print = FindWindowEx(PrintDialog, IntPtr.Zero, "Button", "Print"); SendMessage((IntPtr)Print, BN_CLICKED, 0, IntPtr.Zero); Thread.Sleep(2000); } // COSE WINDOWS // end: Thread.Sleep(1000); SendKeys.SendWait("%{F4}"); Thread.Sleep(1000); IntPtr SaveFileDialog = FindWindowEx(ZebraDesigner, IntPtr.Zero, "#32770", "ZebraDesigner - Plauktiem dzeltena.lbl"); IntPtr ButtonNo = FindWindowEx(SaveFileDialog, IntPtr.Zero, "Button", "&No"); SendMessage((IntPtr)ButtonNo, BN_CLICKED, 0, IntPtr.Zero); Thread.Sleep(1000); }
public void Execute(object o = null) { SendKeys.SendWait("{DOWN}"); }
/// <summary> /// Coauther OneNote file WithoutConflict /// </summary> /// <param name="filename">The coauthered OneNote file name</param> public static void OneNoteCoauthorWithoutConflict(string oneNote) { string filename = oneNote.Split('\\').Last().Split('.').First(); // Upload a document SharepointClient.UploadFile(oneNote); // Refresh web address Browser.Goto(Browser.DocumentAddress); // Find document on site IWebElement document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".one']")); string curWinHandle = Browser.webDriver.CurrentWindowHandle; // Open OneNote document in local Onenote App Browser.RClick(document); Thread.Sleep(1000); Browser.Wait(By.LinkText("Open in OneNote")); var elementOpenInOneNote = Browser.webDriver.FindElement(By.LinkText("Open in OneNote")); Browser.Click(elementOpenInOneNote); Utility.WaitForOneNoteDocumentOpenning(filename, false, true); Thread.Sleep(2000); SendKeys.SendWait("Local"); Thread.Sleep(3000); // Switch To Web Browser Browser.webDriver.SwitchTo().Window(curWinHandle); Thread.Sleep(2000); // Click OneNote file on Sharepoint Web Server Browser.Click(document); Thread.Sleep(3000); Browser.Wait(By.Id("WebApplicationFrame")); Browser.webDriver.SwitchTo().Frame("WebApplicationFrame"); // Wait for online edit saved Thread.Sleep(3000); Browser.Wait(By.XPath("//a[@id='lblSyncStatus-Medium']/span[2][text()='Saved']")); Thread.Sleep(3000); SendKeys.SendWait("Online"); Thread.Sleep(3000); Browser.Wait(By.XPath("//a[@id='lblSyncStatus-Medium']/span[2][text()='Saving...']")); Thread.Sleep(10000); Browser.Wait(By.XPath("//a[@id='lblSyncStatus-Medium']/span[2][text()='Saved']")); Thread.Sleep(5000); // Refresh web address Browser.Goto(Browser.DocumentAddress); Thread.Sleep(2000); document = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".one']")); // Open OneNote document in local Onenote App Browser.RClick(document); Thread.Sleep(1000); Browser.Wait(By.LinkText("Open in OneNote")); elementOpenInOneNote = Browser.webDriver.FindElement(By.LinkText("Open in OneNote")); Browser.Click(elementOpenInOneNote); //Utility.WaitForOneNoteDocumentOpenning(filename, false, true); ///////////////////////////////////////////////////////////////////////////////// // Get the opened OneNote process, and read the page title. OneNote.Application oneNoteApp = new OneNote.Application(); string oneNoteXml; var oneNoteWindow = oneNoteApp.Windows.CurrentWindow; oneNoteApp.GetPageContent(oneNoteWindow.CurrentPageId, out oneNoteXml); var xmlDoc = new XmlDocument(); xmlDoc.LoadXml(oneNoteXml); var nsmgr = new XmlNamespaceManager(xmlDoc.NameTable); nsmgr.AddNamespace("one", "http://schemas.microsoft.com/office/onenote/2013/onenote"); string titleXpath = "//one:Page/one:Title/one:OE/one:T"; System.Xml.XmlCDataSection titleNode = xmlDoc.SelectSingleNode(titleXpath, nsmgr).FirstChild as System.Xml.XmlCDataSection; // If its title in local Onenote App is not updated and wait. while (!titleNode.Value.ToString().Contains("OnlineLocal")) { Thread.Sleep(5000); oneNoteWindow = oneNoteApp.Windows.CurrentWindow; oneNoteApp.GetPageContent(oneNoteWindow.CurrentPageId, out oneNoteXml); xmlDoc.LoadXml(oneNoteXml); titleNode = xmlDoc.SelectSingleNode(titleXpath, nsmgr).FirstChild as System.Xml.XmlCDataSection; } /////////////////////////////////////////////////////////////////////////////////// // Closed OneNote App. oneNoteApp.Windows.CurrentWindow.Active = true; SendKeys.SendWait("%{F4}"); // Delete the new upload document SharepointClient.DeleteFile(filename + ".one"); }
///<summary> /// Returns -1 if Hearthstone loses focus /// </summary> public static async Task <int> AddCardToDeck(Card card, ExportingInfo info) { if (!User32.IsHearthstoneInForeground()) { Core.MainWindow.ShowMessage("Exporting aborted", "Hearthstone window lost focus.").Forget(); Log.Info("Exporting aborted, window lost focus"); return(-1); } if (Config.Instance.ExportForceClear) { await ClearSearchBox(info.HsHandle, info.SearchBoxPos); } await ClickOnPoint(info.HsHandle, info.SearchBoxPos); if (Config.Instance.ExportPasteClipboard) { Clipboard.SetText(GetSearchString(card)); SendKeys.SendWait("^v"); } else { SendKeys.SendWait(GetSearchString(card)); } SendKeys.SendWait("{ENTER}"); Log.Info("try to export card: " + card); await Task.Delay(Config.Instance.DeckExportDelay * 2); if (await CheckForSpecialCases(card, info.CardPosX + 50, info.Card2PosX + 50, info.CardPosY + 50, info.HsHandle)) { return(0); } //Check if Card exist in collection var cardExists = await CardExists(info.HsHandle, (int)info.CardPosX, (int)info.CardPosY, info.HsRect.Width, info.HsRect.Height); if (cardExists) { //Check if a golden exist if (Config.Instance.PrioritizeGolden && await CardExists(info.HsHandle, (int)info.Card2PosX, (int)info.CardPosY, info.HsRect.Width, info.HsRect.Height)) { await ClickOnPoint(info.HsHandle, new Point((int)info.Card2PosX + 50, (int)info.CardPosY + 50)); if (card.Count == 2) { await ClickOnPoint(info.HsHandle, new Point((int)info.Card2PosX + 50, (int)info.CardPosY + 50)); await ClickOnPoint(info.HsHandle, new Point((int)info.CardPosX + 50, (int)info.CardPosY + 50)); } } else { await ClickOnPoint(info.HsHandle, new Point((int)info.CardPosX + 50, (int)info.CardPosY + 50)); if (card.Count == 2) { //Check if two card are not available await Task.Delay(200 - Config.Instance.DeckExportDelay); if (await CardHasLock(info.HsHandle, (int)(info.CardPosX + info.HsRect.Width * 0.048), (int)(info.CardPosY + info.HsRect.Height * 0.287), info.HsRect.Width, info.HsRect.Height)) { var card2Exists = await CardExists(info.HsHandle, (int)info.Card2PosX, (int)info.CardPosY, info.HsRect.Width, info.HsRect.Height); if (card2Exists) { await ClickOnPoint(info.HsHandle, new Point((int)info.Card2PosX + 50, (int)info.CardPosY + 50)); return(0); } Log.Info("Only one copy found: " + card.Name); return(1); } await ClickOnPoint(info.HsHandle, new Point((int)info.CardPosX + 50, (int)info.CardPosY + 50)); } } } else { return(card.Count); } return(0); }
private void timer1_Tick(object sender, EventArgs e) { String textt = textBox1.Text; SendKeys.SendWait(textt); }
public void Release() { SendKeys.SendWait("{ENTER}"); NativeMethods.FreeConsole(); }
private void btn_hardcopy_Click(object sender, EventArgs e) { //Altキー+Print Screenキーの送信 SendKeys.SendWait("%{PRTSC}"); }
async void gunMacros(int number) { string lang = "00000409"; int ret = LoadKeyboardLayout(lang, 1); PostMessage(GetForegroundWindow(), 0x50, 1, ret); SendKeys.SendWait("{F6}"); await Task.Delay(Program.delay); SendKeys.SendWait("/mn"); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); await Task.Delay(Program.delay); SendKeys.SendWait("{Down 15}"); await Task.Delay(Program.delay); SendKeys.SendWait("{Up 4}"); await Task.Delay(Program.delay); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); await Task.Delay(Program.delay); SendKeys.SendWait("{Up 2}"); await Task.Delay(Program.delay); if (number == 2) { SendKeys.SendWait("{Down}"); await Task.Delay(Program.delay); } if (number == 3) { SendKeys.SendWait("{Down 2}"); await Task.Delay(Program.delay); } SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); await Task.Delay(Program.delay); SendKeys.SendWait("^{HOME}"); await Task.Delay(Program.delay); SendKeys.SendWait("^+{END}"); await Task.Delay(Program.delay); SendKeys.SendWait("{DEL}"); await Task.Delay(Program.delay); if (number == 1) { SendKeys.SendWait($"{Program.g1AmmoCount}"); } if (number == 2) { SendKeys.SendWait($"{Program.g2AmmoCount}"); } if (number == 3) { SendKeys.SendWait($"{Program.g3AmmoCount}"); } await Task.Delay(Program.delay); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); }
private static void Start() { Console.Clear(); if (Settings.Instance == null) { Console.WriteLine("Settings object was null, please load or set some settings"); Console.WriteLine("Press any key to return to main menu"); Console.ReadKey(); return; } var bPrayerActive = Settings.Instance.ActivePrayerHotkeys == null; var bAutoSwitchActive = Settings.Instance.ActiveAutoSwitchHotkeys == null; var bAutoSpecActive = Settings.Instance.SpecialAttackHotkeys == null; if (bPrayerActive && bAutoSwitchActive) { Console.WriteLine("Unable to start since no hotkeys were specified"); Console.WriteLine("Press any key to return to main menu"); Console.ReadKey(); return; } Console.WriteLine("Mousespeed is: " + Settings.Instance.Speed); Console.WriteLine("Return to old pos: " + Settings.Instance.ReturnToOldPos); foreach (var autoSwitchHotkey in Settings.Instance.ActiveAutoSwitchHotkeys) { Console.WriteLine("Autoswitch on hotkey: " + autoSwitchHotkey.Key); } foreach (var prayerHotkey in Settings.Instance.ActivePrayerHotkeys) { Console.WriteLine(prayerHotkey.Key + " on hotkey " + prayerHotkey.Value); } foreach (var spec in Settings.Instance.SpecialAttackHotkeys) { Console.WriteLine("Special attack on hotkey: " + spec.Key); } Console.WriteLine("Press ESC to stop OSRS-AutoSwitcher"); DateTime startTime = DateTime.Now; while (true) { Thread.Sleep(50); var resTime = DateTime.Now - startTime; Console.Write("Been running for: " + Math.Floor(resTime.TotalSeconds) + " seconds"); Console.CursorLeft = 0; if (!bPrayerActive) { foreach (var prayerHotkey in Settings.Instance.ActivePrayerHotkeys) { if (Convert.ToBoolean((long)WindowsImports.GetAsyncKeyState(prayerHotkey.Value) & 0x8000)) { var oldPos = Cursor.Position; SendKeys.SendWait("{" + Settings.Instance.PrayerFkey + "}"); Thread.Sleep(10); Mouse.LinearSmoothMove(Settings.Instance.Prayers[prayerHotkey.Key], Settings.Instance.Speed, true); if (Settings.Instance.ReturnToOldPos) { Mouse.LinearSmoothMove(oldPos, Settings.Instance.Speed, false); } } } } if (!bAutoSwitchActive) { foreach (var autoSwitchHotkey in Settings.Instance.ActiveAutoSwitchHotkeys) { if (Convert.ToBoolean((long)WindowsImports.GetAsyncKeyState(autoSwitchHotkey.Key) & 0x8000)) { if (Settings.Instance.ActiveAutoSwitchHotkeys != null) { var oldPos = Cursor.Position; foreach (var locations in autoSwitchHotkey.Value) { SendKeys.SendWait("{" + Settings.Instance.InventFKey + "}"); Thread.Sleep(10); WindowsImports.SetCursorPos(Settings.Instance.InventorySlots[locations].X, Settings.Instance.InventorySlots[locations].Y); WindowsImports.LeftMouseClick(Settings.Instance.InventorySlots[locations].X, Settings.Instance.InventorySlots[locations].Y); Thread.Sleep(50); } if (Settings.Instance.ReturnToOldPos) { Mouse.LinearSmoothMove(oldPos, Settings.Instance.Speed, false); } } else { Console.WriteLine("Autoswitch inventory settings was null, terminating..."); return; } } } } if (!bAutoSpecActive) { if (Settings.Instance.SpecialAttackHotkeys != null) { foreach (var hotkey in Settings.Instance.SpecialAttackHotkeys) { if (Convert.ToBoolean((long)WindowsImports.GetAsyncKeyState(hotkey.Key) & 0x8000)) { var oldPos = Cursor.Position; SendKeys.SendWait("{" + Settings.Instance.InventFKey + "}"); foreach (var specWep in hotkey.Value.InventoryId) { Thread.Sleep(10); Mouse.LinearSmoothMove(new Point( Settings.Instance.InventorySlots[specWep].X, Settings.Instance.InventorySlots[specWep].Y), Settings.Instance.Speed, true); Thread.Sleep(10); } SendKeys.SendWait("{" + Settings.Instance.AttackFkey + "}"); Thread.Sleep(Settings.Instance.WaitForSpecBar ? 450 : 100); Mouse.LinearSmoothMove(oldPos, Settings.Instance.Speed, true); int pressedCounter = 0; while (pressedCounter != hotkey.Value.SpecTimes) { Mouse.LinearSmoothMove(Settings.Instance.SpecialAttackBarPoint, Settings.Instance.Speed, true); Thread.Sleep(100); pressedCounter++; } Mouse.LinearSmoothMove(oldPos, Settings.Instance.Speed, true); if (Settings.Instance.ReturnToOldPos) { Mouse.LinearSmoothMove(oldPos, Settings.Instance.Speed, false); } } } } if (Convert.ToBoolean((long)WindowsImports.GetAsyncKeyState(Keys.Escape) & 0x0001)) { break; } } } }
async void foo(Message m) { if (m.Msg == WM_HOTKEY) { if (m.WParam.ToString() == "0") { gunMacros(1); } if (m.WParam.ToString() == "1") { gunMacros(2); } if (m.WParam.ToString() == "2") { gunMacros(3); } if (m.WParam.ToString() == "3") { await Task.Delay(Program.delay); SendKeys.SendWait("{Up 17}"); await Task.Delay(Program.delay); SendKeys.SendWait("{Down 6}"); await Task.Delay(Program.delay); if (Program.isMheal) { await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); } if (Program.isHeal) { await Task.Delay(Program.delay); SendKeys.SendWait("{Down}"); await Task.Delay(Program.delay); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); } if (Program.isMask) { if (!Program.isHeal) { await Task.Delay(Program.delay); SendKeys.SendWait("{Down}"); } await Task.Delay(Program.delay); SendKeys.SendWait("{Down}"); await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); SendKeys.SendWait("{Up 4}"); await Task.Delay(Program.delay); if (Program.numberMask == 2) { SendKeys.SendWait("{Down}"); await Task.Delay(Program.delay); } if (Program.numberMask == 3) { SendKeys.SendWait("{Down 2}"); await Task.Delay(Program.delay); } if (Program.numberMask == 4) { SendKeys.SendWait("{Down 3}"); await Task.Delay(Program.delay); } if (Program.numberMask == 5) { SendKeys.SendWait("{Down 4}"); await Task.Delay(Program.delay); } await Task.Delay(Program.delay); SendKeys.SendWait("{ENTER}"); await Task.Delay(Program.delay); SendKeys.SendWait("{ESC}"); } await Task.Delay(Program.delay); SendKeys.SendWait("{ESC}"); } } }
public int SetTextValue(String windowName, String objName, String value) { AutomationElement childHandle = GetObjectHandle(windowName, objName); if (!utils.IsEnabled(childHandle)) { childHandle = null; throw new XmlRpcFaultException(123, "Object state is disabled"); } object valuePattern = null; try { if (childHandle.Current.ControlType == ControlType.ComboBox) { AutomationElement o = null; ArrayList objectList = new ArrayList(); ControlType[] type = new ControlType[1] { ControlType.Edit }; // NOTE: Using "*" for object name, which returns the first // matching Edit control type o = utils.InternalGetObjectHandle(childHandle, "*", type, ref objectList); if (o != null) { childHandle = o; } objectList = null; } // Reference: http://msdn.microsoft.com/en-us/library/ms750582.aspx if (!childHandle.TryGetCurrentPattern(ValuePattern.Pattern, out valuePattern)) { childHandle.SetFocus(); SendKeys.SendWait(value); } else { ((ValuePattern)valuePattern).SetValue(value); } } catch (Exception ex) { LogMessage(ex); if (ex is XmlRpcFaultException) { throw; } else { throw new XmlRpcFaultException(123, "Unhandled exception: " + ex.Message); } } finally { childHandle = null; valuePattern = null; } return(1); }
public void TestActivateAddToolboxItem(DTE2 DTE) { DTE.ItemOperations.NewFile("General\\Object-Role Modeling File", "ORMRolePlayerRequiredModel", ""); ORMTestHooks testHooks = new ORMTestHooks(DTE); ORMTestWindow testWindow = testHooks.FindORMTestWindow(null); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Entity Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Value Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Objectified Fact Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Binary Fact Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Ternary Fact Type"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "External Uniquess Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Equality Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Inclusive Or Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Exclusion Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Exclusive Or Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Subset Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Frequency Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Ring Constraint"); SendKeys.SendWait("{Enter}"); // Activate the type and hit enter to add to the model CommonTestHooks.ActivateToolboxItem(DTE, "ORM Designer", "Model Note"); SendKeys.SendWait("{Enter}"); // Connectors can not be added to the model // This includes: Model Note Connector, Subtype Connector, Role Connector, as well // as the Pointer. }
private void txtCelular_TextChanged(object sender, EventArgs e) { txtCelular.Text = Funcoes.Formata_Celular(txtCelular.Text); SendKeys.SendWait("{END}"); }
public void Execute(object o = null) { SendKeys.SendWait("{BACKSPACE}!"); }
public static void send(CmsForm cmsForm, string content, string content_img, ArrayList imgList, string content_org, int url_type, int goods_type) { string out_log = ""; GStruct0 gStruct0; try { if (cmsForm.radioButton_fasong_weixin_fashi_houtai.Checked) { WeixinUtil.login(cmsForm); WeixinUtil.send_houtai(cmsForm, content, content_img, imgList); return; } if (cmsForm.appBean.weixin_list == null || cmsForm.appBean.weixin_list.Count == 0) { LogUtil.log_call(cmsForm, "没有微信群!"); return; } //this.string_50 = this.method_151(cmsForm); //.ᜃ(this.string_50); //ContentItem contentItem = WeixinUtil.get_weixin_content(cmsForm,content,out out_log); //LogUtil.log_call(cmsForm, gClass27.content); int i = 0; while (i < cmsForm.appBean.weixin_list.Count) { if (!cmsForm.appBean.send_status && !cmsForm.appBean.qunfa_genfa_qunfa_status) { out_log = "群发被强制停止"; return; } else { string item = (string)cmsForm.appBean.weixin_list[i]; string weiba_all = QqUtil.weiba(cmsForm, out out_log); string weiba = ""; string weixin_pid = PidUtil.get_weixin_pid_qun(cmsForm, item, cmsForm.appBean.member_id, out weiba); if (!string.IsNullOrEmpty(weixin_pid)) { if (goods_type != 2) { ContentItem contentItem_qun = UrlUtil.parseContent(cmsForm, content_org, weixin_pid, cmsForm.checkBox_qunfa_pid.Checked, false, url_type); UrlUtil.parseContent_weixin(cmsForm, contentItem_qun, weixin_pid, cmsForm.checkBox_qunfa_pid.Checked); UrlUtil.template_qq(cmsForm, contentItem_qun, weixin_pid, cmsForm.checkBox_qunfa_pid.Checked, cmsForm.appBean.weixin_template); content = contentItem_qun.content_weixin; content_img = contentItem_qun.content_weixin_img; imgList = contentItem_qun.imgList; weiba_all = weiba; } else { ContentItem contentItem_qun = UrlHptUtil.parseContent(cmsForm, content_org, weixin_pid, cmsForm.checkBox_qunfa_pid.Checked, false, url_type); UrlUtil.parseContent_weixin(cmsForm, contentItem_qun, weixin_pid, false); content = contentItem_qun.content_send; content = WeixinUtil.remove_img(content); LogUtil.log_call(cmsForm, content); content_img = contentItem_qun.content_weixin_img; imgList = contentItem_qun.imgList; weiba_all = weiba; } } else { if (goods_type != 2) { } else { content = WeixinUtil.remove_img(content); } } IntPtr intPtr = CmsForm.FindWindow(null, item); if (intPtr == IntPtr.Zero) { out_log = string.Concat("微信群【", item, "】窗口没有打开,软件自动拖动微信群成为独立的窗口!"); CmsForm.EnumWindows(new GDelegate66(cmsForm.method_121), IntPtr.Zero); if (!WeixinUtil.method_120(cmsForm.appBean.weixin_win_id)) { LogUtil.log_call(cmsForm, "微信没有打开!"); goto Label2; } LogUtil.log_call(cmsForm, "微信已经打开!正在拖动。。。。"); CmsForm.ShowWindowAsync(cmsForm.appBean.weixin_win_id, GClass13.int_13); Thread.Sleep(150); CmsForm.SetForegroundWindow(cmsForm.appBean.weixin_win_id); Thread.Sleep(150); CmsForm.GetWindowRect(cmsForm.appBean.weixin_win_id, out gStruct0); MouseUtil.smethod_9(cmsForm.appBean.weixin_win_id, gStruct0.int_0 + 100, gStruct0.int_1 + 25); Thread.Sleep(200); SendKeys.SendWait("{BACKSPACE}"); Thread.Sleep(200); SendKeys.SendWait(item); Thread.Sleep(200); SendKeys.SendWait("{ENTER}"); Thread.Sleep(250); MouseUtil.smethod_13(gStruct0.int_0 + 100, gStruct0.int_1 + 75, gStruct0.int_0 + 400); Thread.Sleep(150); } intPtr = CmsForm.FindWindow(null, item); if (intPtr != IntPtr.Zero) { CmsForm.ShowWindowAsync(intPtr, GClass13.int_13); Thread.Sleep(150); CmsForm.SetForegroundWindow(intPtr); Thread.Sleep(150); CmsForm.GetWindowRect(intPtr, out gStruct0); MouseUtil.smethod_9(intPtr, gStruct0.int_2 - 60, gStruct0.int_3 - 70); if (content_img != null && !"".Equals(content_img)) { //LogUtil.log_call(cmsForm, content_img); //CommonUtil.clipboard(content_img, out out_log); QqUtil.copy_content(cmsForm, content_img, out out_log); Thread.Sleep(1000); MouseUtil.paste(); //粘贴消息 Thread.Sleep(1000); MouseUtil.enter(); // 回车 Thread.Sleep(1000); LogUtil.log_call(cmsForm, "发送图片结束"); try { Thread.Sleep(int.Parse(cmsForm.textBox_qunfa_weixin_fatu_times.Text.Trim())); } catch (Exception) { Thread.Sleep(1000); } } if ((content != null && !content.Equals(""))) { //CommonUtil.clipboard(string.Concat(content, QqUtil.weiba(cmsForm, out out_log)), out out_log); QqUtil.copy_content(cmsForm, string.Concat(content, weiba_all), out out_log); Thread.Sleep(1000); MouseUtil.paste(); //粘贴消息 Thread.Sleep(1000); MouseUtil.enter(); // 回车 Thread.Sleep(1000); } Thread.Sleep(1000); } else { LogUtil.log_call(cmsForm, string.Concat("微信群【", item, "】窗口没有打开,软件拖动失败,跳过跟发!")); } Label2: i = i + 1; } } //this.bool_34 = false; //this.string_76 = ""; //this.int_26 = 0; if (!cmsForm.checkBox_qunfa_qq_zuixiaohua.Checked) { QqUtil.method_167(cmsForm, out out_log); } else { QqUtil.method_168(cmsForm, out out_log); } //QqUtil.method_156(cmsForm); //QqUtil.method_134(cmsForm); LogUtil.log_call(cmsForm, "微信群发完成!"); } catch (Exception exception) { LogUtil.log_call(cmsForm, string.Concat("[autoSendWeixin]出错:", exception.ToString())); } return; }
/// <summary> /// Coauther OneNote file WithConflict /// </summary> /// <param name="oneNote"></param> public static void OneNoteCoauthorWithConflict(string oneNote) { string filename = oneNote.Split('\\').Last().Split('.').First(); // Upload a document SharepointClient.UploadFile(oneNote); // Refresh web address Browser.Goto(Browser.DocumentAddress); // Find document on site IWebElement onenote = Browser.webDriver.FindElement(By.CssSelector("a[href*='" + filename + ".one']")); string DocumentWinHandle = Browser.webDriver.CurrentWindowHandle; // Open OneNote document in local Onenote App Browser.RClick(onenote); Browser.Wait(By.LinkText("Open in OneNote")); var elementOpenInOneNote = Browser.webDriver.FindElement(By.LinkText("Open in OneNote")); Browser.Click(elementOpenInOneNote); Utility.WaitForOneNoteDocumentOpenning(filename, false, true); SendKeys.SendWait("Insert by onenote App"); Thread.Sleep(2000); // Click the document in root site Browser.RClick(onenote); Browser.Wait(By.LinkText("Open in OneNote Online")); var elementOpenOnline = Browser.webDriver.FindElement(By.LinkText("Open in OneNote Online")); Browser.Click(elementOpenOnline); //Browser.webDriver.FindElement(By.XPath("//a[@id='lblSyncStatus-Medium']/span[2][text()='Saved']")); Thread.Sleep(5000); SendKeys.SendWait("^a");; Thread.Sleep(1000); SendKeys.SendWait("{DELETE}"); // Switch To Web Browser Browser.webDriver.SwitchTo().Window(DocumentWinHandle); // Open OneNote document in local Onenote App Browser.RClick(onenote); Browser.Wait(By.LinkText("Open in OneNote")); elementOpenInOneNote = Browser.webDriver.FindElement(By.LinkText("Open in OneNote")); Browser.Click(elementOpenInOneNote); Thread.Sleep(2000); // Save current window handle string curWinHandle = Browser.webDriver.CurrentWindowHandle; SendKeys.SendWait("^a"); SendKeys.SendWait("{DELETE}"); Thread.Sleep(2000); Browser.RClick(onenote); Browser.Wait(By.LinkText("Open in OneNote Online")); elementOpenOnline = Browser.webDriver.FindElement(By.LinkText("Open in OneNote Online")); Browser.Click(elementOpenOnline); Thread.Sleep(40000); //var merge = Browser.webDriver.FindElement(By.XPath("//span[@class='WACBusinessBarBody'][text()='This page contains conflicting changes. Click here to show versions of the page with unmerged changes.']")); Browser.RClick(onenote); Browser.Wait(By.LinkText("Open in OneNote")); elementOpenInOneNote = Browser.webDriver.FindElement(By.LinkText("Open in OneNote")); Browser.Click(elementOpenInOneNote); Thread.Sleep(30000); //Delete conflict page version in OneNote local App. SendKeys.SendWait("+(^w)"); Thread.Sleep(2000); SendKeys.SendWait("+(^w)"); Thread.Sleep(2000); SendKeys.SendWait("{ENTER}"); Thread.Sleep(2000); // Get the opened OneNote process, and edit it OneNote.Application oneNoteApp = new OneNote.Application(); var oneNoteWindow = oneNoteApp.Windows.CurrentWindow; // Closed OneNote App. oneNoteApp.CloseNotebook(oneNoteWindow.CurrentNotebookId); SendKeys.SendWait("%{f4}"); // Delete the new upload document SharepointClient.DeleteFile(filename + ".one"); }
public void Execute(object o = null) { SendKeys.SendWait("{RIGHT}"); }
public static void sendW() { SendKeys.SendWait("w"); }