private void populateEdit(InterfaceResponse edit, string text) { string currText = edit.Name; if (!currText.Equals(text)) { if (currText != "") { m.move(new Point(ran.Next(edit.X + 5, edit.X + edit.Width - 15), ran.Next(edit.Y + 5, edit.Y + edit.Height - 5))); Thread.Sleep(ran.Next(300, 500)); m.click(true); Thread.Sleep(ran.Next(100, 300)); for (int i = 0; i < currText.Length; i++) { kb.sendChar((char)KeyBoard.VKeys.VK_BACK); Thread.Sleep(ran.Next(150, 190)); } pm.synchronize(m); } if (currText == "") { m.move(new Point(ran.Next(edit.X + 5, edit.X + edit.Width - 5), ran.Next(edit.Y + 5, edit.Y + edit.Height - 5))); Thread.Sleep(ran.Next(300, 500)); m.click(true); Thread.Sleep(ran.Next(100, 300)); kb.sendKeyPresses(text); pm.synchronize(m); } } }
/// <summary> /// Check if the edit field has the info we want /// </summary> /// <param name="edit">The edit field</param> /// <param name="text">The text we want it to contain</param> /// <returns>True if they are equal, false otherwise</returns> public bool checkEdit(InterfaceResponse edit, string text) { return edit.Name.Equals(text); }