C#鼠标键盘操作用于桌面脚本
项目中添加这两个类KeyBord ,MoseKeyboard(文末)
对于有些软件获取不到具体控件的句柄,那就只能用鼠标键盘操作了
比如想执行一个粘贴操作,可以这样写,通常需要在新起的线程中写,不然复制到粘贴板那会报错
Clipboard.SetDataObject("123456", true);//复制到粘贴板MoseKeyboard.ExcuteCmd("1000,Mouse,1597,442,LeftButtonClick"); //点击文本框MoseKeyboard.ExcuteCmd("1000,KeyBord,Control+V");//粘贴
起线程传入数组参数示例
string[] array = new string[]{"100,Mouse,1017,242,LeftButtonClick","1000,Mouse,891,514,RightButtonClick"};Thread ThreadPause = new Thread(new ParameterizedThreadStart(RunTest));ThreadPause.Start(array);private void RunTest(object obj){string[] strArray = (string[])obj;}
传入的string参数如为分别为,时间间隔,操作类型,屏幕坐标xy,操作,
这里用按键精灵显示(我的资源中有https://download.csdn.net/download/m0_37137902/14900615)
通常脚本需要截取字符串,比如截取 ABC中A和C之间的B,可以用下面这个方法
string str = GetStringOfStartAndEnd()("A", "B", "ABC");
public Func<string, string, string, string> GetStringOfStartAndEnd(){return (x, y, z) =>{string str = string.Empty;int start = z.IndexOf(x);int end = z.IndexOf(y);if (end > start){str = z.Substring(start + x.Length, end - start - x.Length);}return str;};}
直接取到末尾用这个方法,比如想得到abcd中,b以后的字段(当然这两个方法没啥难度,经常用就写到这方便后面复制)
string str = GetStringOfStartAndEndHttp()("abcd", "b");
public Func<string, string, string> GetStringOfStartAndEndHttp(){return (x, y) =>{string str = string.Empty;int start = x.IndexOf(y) + y.Length;int length = x.Length - start;str = x.Substring(start, length);return str;};}
脚本通常也需要获取url返回的值
public string HttpGet(string url){Encoding encoding = Encoding.UTF8;HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);request.Method = "GET";request.Accept = "text/html, application/xhtml+xml, */*";request.ContentType = "application/json";HttpWebResponse response = (HttpWebResponse)request.GetResponse();using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)){return reader.ReadToEnd();}}
经常会把执行命令放在txt里,可以用数组的形式读取出来
string[] array=File.ReadAllLines(Application.StartupPath + @"\mytxt.txt", Encoding.Default);
按键枚举类
public enum KeyBord : int{// 摘要:// 从键值提取修饰符的位屏蔽。Modifiers = -65536,//// 摘要:// Backspace 键。Backspace = 8,//// 摘要:// Tab 键。Tab = 9,//// 摘要:// LINEFEED 键。LineFeed = 10,//// 摘要:// Clear 键。Clear = 12,//// 摘要:// Enter 键。Enter = 13,//// 摘要:// Return 键。Return = 13,//// 摘要:// Shift 键。ShiftKey = 16,//// 摘要:// Ctrl 键。ControlKey = 17,//// 摘要:// Alt 键。Menu = 18,//// 摘要:// Pause 键。Pause = 19,//// 摘要:// Caps Lock 键。CapsLock = 20,//// 摘要:// Caps Lock 键。Capital = 20,//// 摘要:// IME Kana 模式键。KanaMode = 21,//// 摘要:// IME Hanguel 模式键。(为了保持兼容性而设置;使用 HangulMode)HanguelMode = 21,//// 摘要:// IME Hangul 模式键。HangulMode = 21,//// 摘要:// IME Junja 模式键。JunjaMode = 23,//// 摘要:// IME 最终模式键。FinalMode = 24,//// 摘要:// IME Kanji 模式键。KanjiMode = 25,//// 摘要:// IME Hanja 模式键。HanjaMode = 25,//// 摘要:// Esc 键。Escape = 27,//// 摘要:// IME 转换键。IMEConvert = 28,//// 摘要:// IME 非转换键。IMENonconvert = 29,//// 摘要:// IME 接受键。已过时,请改用 System.Windows.Forms.Keys.IMEAccept。IMEAceept = 30,//// 摘要:// IME 接受键,替换 System.Windows.Forms.Keys.IMEAceept。IMEAccept = 30,//// 摘要:// IME 模式更改键。IMEModeChange = 31,//// 摘要:// 空格键。Space = 32,//// 摘要:// Page Up 键。Prior = 33,//// 摘要:// Page Up 键。PageUp = 33,//// 摘要:// Page Down 键。Next = 34,//// 摘要:// Page Down 键。PageDown = 34,//// 摘要:// End 键。End = 35,//// 摘要:// Home 键。Home = 36,//// 摘要:// 向左键。Left = 37,//// 摘要:// 向上键。Up = 38,//// 摘要:// 向右键。Right = 39,//// 摘要:// 向下键。Down = 40,//// 摘要:// Select 键。Select = 41,//// 摘要:// Print 键。Print = 42,//// 摘要:// EXECUTE 键。Execute = 43,//// 摘要:// Print Screen 键。PrintScreen = 44,//// 摘要:// Print Screen 键。Snapshot = 44,//// 摘要:// Ins 键。Insert = 45,//// 摘要:// DeL 键。Delete = 46,//// 摘要:// Help 键。Help = 47,//// 摘要:// 0 键。D0 = 48,//// 摘要:// 1 键。D1 = 49,//// 摘要:// 2 键。D2 = 50,//// 摘要:// 3 键。D3 = 51,//// 摘要:// 4 键。D4 = 52,//// 摘要:// 5 键。D5 = 53,//// 摘要:// 6 键。D6 = 54,//// 摘要:// 7 键。D7 = 55,//// 摘要:// 8 键。D8 = 56,//// 摘要:// 9 键。D9 = 57,//// 摘要:// A 键。A = 65,//// 摘要:// B 键。B = 66,//// 摘要:// C 键。C = 67,//// 摘要:// D 键。D = 68,//// 摘要:// E 键。E = 69,//// 摘要:// F 键。F = 70,//// 摘要:// G 键。G = 71,//// 摘要:// H 键。H = 72,//// 摘要:// I 键。I = 73,//// 摘要:// J 键。J = 74,//// 摘要:// K 键。K = 75,//// 摘要:// L 键。L = 76,//// 摘要:// M 键。M = 77,//// 摘要:// N 键。N = 78,//// 摘要:// O 键。O = 79,//// 摘要:// P 键。P = 80,//// 摘要:// Q 键。Q = 81,//// 摘要:// R 键。R = 82,//// 摘要:// S 键。S = 83,//// 摘要:// T 键。T = 84,//// 摘要:// U 键。U = 85,//// 摘要:// V 键。V = 86,//// 摘要:// W 键。W = 87,//// 摘要:// X 键。X = 88,//// 摘要:// Y 键。Y = 89,//// 摘要:// Z 键。Z = 90,//// 摘要:// 左 Windows 徽标键(Microsoft Natural Keyboard,人体工程学键盘)。LWin = 91,//// 摘要:// 右 Windows 徽标键(Microsoft Natural Keyboard,人体工程学键盘)。RWin = 92,//// 摘要:// 应用程序键(Microsoft Natural Keyboard,人体工程学键盘)。Apps = 93,//// 摘要:// 计算机睡眠键。Sleep = 95,//// 摘要:// 数字键盘上的 0 键。NumPad0 = 96,//// 摘要:// 数字键盘上的 1 键。NumPad1 = 97,//// 摘要:// 数字键盘上的 2 键。NumPad2 = 98,//// 摘要:// 数字键盘上的 3 键。NumPad3 = 99,//// 摘要:// 数字键盘上的 4 键。NumPad4 = 100,//// 摘要:// 数字键盘上的 5 键。NumPad5 = 101,//// 摘要:// 数字键盘上的 6 键。NumPad6 = 102,//// 摘要:// 数字键盘上的 7 键。NumPad7 = 103,//// 摘要:// 数字键盘上的 8 键。NumPad8 = 104,//// 摘要:// 数字键盘上的 9 键。NumPad9 = 105,//// 摘要:// 乘号键。Multiply = 106,//// 摘要:// 加号键。Add = 107,//// 摘要:// 分隔符键。Separator = 108,//// 摘要:// 减号键。Subtract = 109,//// 摘要:// 句点键。Decimal = 110,//// 摘要:// 除号键。Divide = 111,//// 摘要:// F1 键。F1 = 112,//// 摘要:// F2 键。F2 = 113,//// 摘要:// F3 键。F3 = 114,//// 摘要:// F4 键。F4 = 115,//// 摘要:// F5 键。F5 = 116,//// 摘要:// F6 键。F6 = 117,//// 摘要:// F7 键。F7 = 118,//// 摘要:// F8 键。F8 = 119,//// 摘要:// F9 键。F9 = 120,//// 摘要:// F10 键。F10 = 121,//// 摘要:// F11 键。F11 = 122,//// 摘要:// F12 键。F12 = 123,//// 摘要:// F13 键。F13 = 124,//// 摘要:// F14 键。F14 = 125,//// 摘要:// F15 键。F15 = 126,//// 摘要:// F16 键。F16 = 127,//// 摘要:// F17 键。F17 = 128,//// 摘要:// F18 键。F18 = 129,//// 摘要:// F19 键。F19 = 130,//// 摘要:// F20 键。F20 = 131,//// 摘要:// F21 键。F21 = 132,//// 摘要:// F22 键。F22 = 133,//// 摘要:// F23 键。F23 = 134,//// 摘要:// F24 键。F24 = 135,//// 摘要:// Num Lock 键。NumLock = 144,//// 摘要:// Scroll Lock 键。Scroll = 145,//// 摘要:// 左 Shift 键。LShiftKey = 160,//// 摘要:// 右 Shift 键。RShiftKey = 161,//// 摘要:// 左 Ctrl 键。LControlKey = 162,//// 摘要:// 右 Ctrl 键。RControlKey = 163,//// 摘要:// 左 Alt 键。LMenu = 164,//// 摘要:// 右 Alt 键。RMenu = 165,//// 摘要:// 浏览器后退键(Windows 2000 或更高版本)。BrowserBack = 166,//// 摘要:// 浏览器前进键(Windows 2000 或更高版本)。BrowserForward = 167,//// 摘要:// 浏览器刷新键(Windows 2000 或更高版本)。BrowserRefresh = 168,//// 摘要:// 浏览器停止键(Windows 2000 或更高版本)。BrowserStop = 169,//// 摘要:// 浏览器搜索键(Windows 2000 或更高版本)。BrowserSearch = 170,//// 摘要:// 浏览器收藏夹键(Windows 2000 或更高版本)。BrowserFavorites = 171,//// 摘要:// 浏览器主页键(Windows 2000 或更高版本)。BrowserHome = 172,//// 摘要:// 静音键(Windows 2000 或更高版本)。VolumeMute = 173,//// 摘要:// 减小音量键(Windows 2000 或更高版本)。VolumeDown = 174,//// 摘要:// 增大音量键(Windows 2000 或更高版本)。VolumeUp = 175,//// 摘要:// 媒体下一曲目键(Windows 2000 或更高版本)。MediaNextTrack = 176,//// 摘要:// 媒体上一曲目键(Windows 2000 或更高版本)。MediaPreviousTrack = 177,//// 摘要:// 媒体停止键(Windows 2000 或更高版本)。MediaStop = 178,//// 摘要:// 媒体播放暂停键(Windows 2000 或更高版本)。MediaPlayPause = 179,//// 摘要:// 启动邮件键(Windows 2000 或更高版本)。LaunchMail = 180,//// 摘要:// 选择媒体键(Windows 2000 或更高版本)。SelectMedia = 181,//// 摘要:// 启动应用程序一键(Windows 2000 或更高版本)。LaunchApplication1 = 182,//// 摘要:// 启动应用程序二键(Windows 2000 或更高版本)。LaunchApplication2 = 183,//// 摘要:// OEM 1 键。Oem1 = 186,//// 摘要:// 美式标准键盘上的 OEM 分号键(Windows 2000 或更高版本)。OemSemicolon = 186,//// 摘要:// 任何国家/地区键盘上的 OEM 加号键(Windows 2000 或更高版本)。Oemplus = 187,//// 摘要:// 任何国家/地区键盘上的 OEM 逗号键(Windows 2000 或更高版本)。Oemcomma = 188,//// 摘要:// 任何国家/地区键盘上的 OEM 减号键(Windows 2000 或更高版本)。OemMinus = 189,//// 摘要:// 任何国家/地区键盘上的 OEM 句点键(Windows 2000 或更高版本)。OemPeriod = 190,//// 摘要:// 美式标准键盘上的 OEM 问号键(Windows 2000 或更高版本)。OemQuestion = 191,//// 摘要:// OEM 2 键。Oem2 = 191,//// 摘要:// 美式标准键盘上的 OEM 波形符键(Windows 2000 或更高版本)。Oemtilde = 192,//// 摘要:// OEM 3 键。Oem3 = 192,//// 摘要:// OEM 4 键。Oem4 = 219,//// 摘要:// 美式标准键盘上的 OEM 左括号键(Windows 2000 或更高版本)。OemOpenBrackets = 219,//// 摘要:// 美式标准键盘上的 OEM 管道键(Windows 2000 或更高版本)。OemPipe = 220,//// 摘要:// OEM 5 键。Oem5 = 220,//// 摘要:// OEM 6 键。Oem6 = 221,//// 摘要:// 美式标准键盘上的 OEM 右括号键(Windows 2000 或更高版本)。OemCloseBrackets = 221,//// 摘要:// OEM 7 键。Oem7 = 222,//// 摘要:// 美式标准键盘上的 OEM 单/双引号键(Windows 2000 或更高版本)。OemQuotes = 222,//// 摘要:// OEM 8 键。Oem8 = 223,//// 摘要:// OEM 102 键。Oem102 = 226,//// 摘要:// RT 102 键的键盘上的 OEM 尖括号或反斜杠键(Windows 2000 或更高版本)。OemBackslash = 226,//// 摘要:// Process Key 键。ProcessKey = 229,//// 摘要:// 用于将 Unicode 字符当作键击传递。Packet 键值是用于非键盘输入法的 32 位虚拟键值的低位字。Packet = 231,//// 摘要:// Attn 键。Attn = 246,//// 摘要:// Crsel 键。Crsel = 247,//// 摘要:// Exsel 键。Exsel = 248,//// 摘要:// ERASE EOF 键。EraseEof = 249,//// 摘要:// Play 键。Play = 250,//// 摘要:// Zoom 键。Zoom = 251,//// 摘要:// 保留以备将来使用的常数。NoName = 252,//// 摘要:// PA1 键。Pa1 = 253,//// 摘要:// Clear 键。OemClear = 254,//// 摘要:// 从键值提取键代码的位屏蔽。KeyCode = 65535,//// 摘要:// Shift 修改键。Shift = 65536,//// 摘要:// Ctrl 修改键。Control = 131072,//// 摘要:// Alt 修改键。Alt = 262144,}
键盘操作MoseKeyboard类
class MoseKeyboard{[DllImport("user32")]public static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);[DllImport("user32.dll")]static extern bool SetCursorPos(int X, int Y);const uint KEYEVENTF_EXTENDEDKEY = 0x1;const uint KEYEVENTF_KEYUP = 0x2;[DllImport("user32.dll")]static extern short GetKeyState(int nVirtKey);[DllImport("user32.dll")]static extern void keybd_event(byte bVk,byte bScan,uint dwFlags,uint dwExtraInfo);public static int x = 0;public static int y = 0;public enum VirtualKeys : byte{VK_NUMLOCK = 0x90, //数字锁定键VK_SCROLL = 0x91, //滚动锁定VK_CAPITAL = 0x14, //大小写锁定VK_A = 62,VK_LEFT = 37, //左箭头 VK_UP = 38,//上箭头 VK_RIGHT = 39,// 右箭头 VK_DOWN = 40,// 下箭头VK_RETURN = 13, //回车VK_DELETE = Keys.Delete}private enum MouseOper : byte{MOVE = 0x0001, /* mouse move */LEFTDOWN = 0x0002, /* left button down */LEFTUP = 0x0004, /* left button up */RIGHTDOWN = 0x0008, /* right button down */RIGHTUP = 0x0010,}public static bool GetState(KeyBord Key){return (GetKeyState((int)Key) == 1);}private static void SetState(KeyBord Key, bool State){if (State != GetState(Key)){keybd_event((byte)Key, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);keybd_event((byte)Key, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);}}public static void LeftButtonClick(int x, int y)//左键单击{SetCurPos(x, y);mouse_event((int)(MouseOper.LEFTDOWN | MouseOper.LEFTUP), 0, 0, 0, 0);}public static void LeftButtonDoubleClick(int x, int y)//左键双击{SetCurPos(x, y);mouse_event((int)(MouseOper.LEFTDOWN | MouseOper.LEFTUP), 0, 0, 0, 0);mouse_event((int)(MouseOper.LEFTDOWN | MouseOper.LEFTUP), 0, 0, 0, 0);}public static void RightButtonClick(int x, int y)//右键单击{SetCurPos(x, y);mouse_event((int)(MouseOper.RIGHTDOWN | MouseOper.RIGHTUP), 0, 0, 0, 0);}public static void SetCurPos(int x, int y){SetCursorPos(x, y);}public static void PressKey(KeyBord key)//模拟按键按下和弹起{keybd_event((byte)key, 0x45, 0, 0);//按键按下// Simulate a key releasekeybd_event((byte)key, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);//按键弹起}public static void Compositekey(KeyBord key1, KeyBord key2, KeyBord key3){keybd_event((byte)key1, (byte)0, 0, 0);//key1按下 keybd_event((byte)key1, (byte)0, 0, 0);//key2按下 MoseKeyboard.PressKey(key3);//key3按下弹起keybd_event((byte)key2, (byte)0, KEYEVENTF_KEYUP, 0);//key2弹起keybd_event((byte)key1, (byte)0, KEYEVENTF_KEYUP, 0);//key1弹起}public static void Compositekey(KeyBord key1, KeyBord key2){keybd_event((byte)key1, (byte)0, 0, 0);//key1按下 MoseKeyboard.PressKey(key2);//key3按下弹起keybd_event((byte)key1, (byte)0, KEYEVENTF_KEYUP, 0);//key1弹起}public static bool ExcuteCmd(string cmd)//执行单行命令{if (cmd == "")return false;//cmd格式是:延时,类型,(鼠标X,Y),命令string[] str = cmd.Split(',');//分解命令if (str.Length < 3 || str.Length > 5)//命令是否正确return false;try{Thread.Sleep(int.Parse(str[0]));//延时操作if (str[1] == "KeyBord")//键盘操作{string[] keys = str[2].Split('+');//分解按键if (keys.Length == 1)//单个健按下{MoseKeyboard.PressKey(GetKeyByString(keys[0]));return true;}if (keys.Length == 2)//2个复合键按下{MoseKeyboard.Compositekey(GetKeyByString(keys[0]), GetKeyByString(keys[1]));return true;}if (keys.Length == 2)//3个复合键按下{MoseKeyboard.Compositekey(GetKeyByString(keys[0]), GetKeyByString(keys[1]), GetKeyByString(keys[2]));return true;}return false;}if (str[1] == "Mouse")//鼠标操作{if (str[4] == "LeftButtonClick")//左键单击{MoseKeyboard.LeftButtonClick(int.Parse(str[2]), int.Parse(str[3]));return true;}if (str[4] == "LeftButtonDoubleClick")//左键双击{MoseKeyboard.LeftButtonDoubleClick(int.Parse(str[2]), int.Parse(str[3]));return true;}if (str[4] == "RightButtonClick")//右键单击{MoseKeyboard.RightButtonClick(int.Parse(str[2]), int.Parse(str[3]));return true;}return false;}return false;}catch (Exception ex){return false;}}public static KeyBord GetKeyByString(string key){if (key == "A")return KeyBord.A;if (key == "B")return KeyBord.B;if (key == "C")return KeyBord.C;if (key == "D")return KeyBord.D;if (key == "E")return KeyBord.E;if (key == "F")return KeyBord.F;if (key == "G")return KeyBord.G;if (key == "H")return KeyBord.H;if (key == "I")return KeyBord.I;if (key == "J")return KeyBord.J;if (key == "K")return KeyBord.K;if (key == "L")return KeyBord.L;if (key == "M")return KeyBord.M;if (key == "N")return KeyBord.N;if (key == "O")return KeyBord.O;if (key == "P")return KeyBord.P;if (key == "Q")return KeyBord.Q;if (key == "R")return KeyBord.R;if (key == "S")return KeyBord.S;if (key == "T")return KeyBord.T;if (key == "U")return KeyBord.U;if (key == "V")return KeyBord.V;if (key == "W")return KeyBord.W;if (key == "X")return KeyBord.X;if (key == "Y")return KeyBord.Y;if (key == "Z")return KeyBord.Z;//A-Zif (key == "F1")return KeyBord.F1;if (key == "F2")return KeyBord.F2;if (key == "F3")return KeyBord.F3;if (key == "F4")return KeyBord.F4;if (key == "F5")return KeyBord.F5;if (key == "F6")return KeyBord.F6;if (key == "F7")return KeyBord.F7;if (key == "F8")return KeyBord.F8;if (key == "F9")return KeyBord.F9;if (key == "F10")return KeyBord.F10;if (key == "F11")return KeyBord.F11;if (key == "F12")return KeyBord.F12;//F1-F12if (key == "Esc")return KeyBord.Escape;if (key == "0")return KeyBord.D0;if (key == "1")return KeyBord.D1;if (key == "2")return KeyBord.D2;if (key == "3")return KeyBord.D3;if (key == "4")return KeyBord.D4;if (key == "5")return KeyBord.D5;if (key == "6")return KeyBord.D6;if (key == "7")return KeyBord.D7;if (key == "8")return KeyBord.D8;if (key == "9")return KeyBord.D9;//0-9if (key == "-")return KeyBord.OemMinus;if (key == "=")return KeyBord.Oemplus;if (key == @"\")return KeyBord.OemBackslash;if (key == "BackSpace")return KeyBord.Backspace;if (key == "Tab")return KeyBord.Tab;if (key == "CapsLock")return KeyBord.CapsLock;if (key == "Windows")return KeyBord.LWin;if (key == "Alt")return KeyBord.Alt;if (key == "Shift")return KeyBord.ShiftKey;if (key == "Control")return KeyBord.ControlKey;if (key == "[")return KeyBord.OemOpenBrackets;if (key == "]")return KeyBord.Oem6;if (key == ";")return KeyBord.OemSemicolon;if (key == "'")return KeyBord.OemQuotes;if (key == ",")return KeyBord.Oemcomma;if (key == ".")return KeyBord.OemPeriod;if (key == "?")return KeyBord.OemQuestion;if (key == "Space")return KeyBord.Space;if (key == "<")return KeyBord.Oemcomma;if (key == ">")return KeyBord.OemPeriod;if (key == "/")return KeyBord.OemQuestion;if (key == "~")return KeyBord.Oem3;if (key == "Inst")/控制键盘return KeyBord.Insert;if (key == "Home")return KeyBord.Home;if (key == "End")return KeyBord.End;if (key == "Enter")return KeyBord.Enter;if (key == "PageDw")return KeyBord.PageDown;if (key == "PageUp")return KeyBord.PageUp;if (key == "Left")return KeyBord.Left;if (key == "Right")return KeyBord.Right;if (key == "Up")return KeyBord.Up;if (key == "Down")return KeyBord.Down;if (key == "PrintScreen")return KeyBord.PrintScreen;if (key == "Scroll")return KeyBord.Scroll;if (key == "Num0")//数字键盘return KeyBord.NumPad0;if (key == "Num1")return KeyBord.NumPad1;if (key == "Num2")return KeyBord.NumPad2;if (key == "Num3")return KeyBord.NumPad3;if (key == "Num4")return KeyBord.NumPad4;if (key == "Num5")return KeyBord.NumPad5;if (key == "Num6")return KeyBord.NumPad6;if (key == "Num7")return KeyBord.NumPad7;if (key == "Num8")return KeyBord.NumPad8;if (key == "Num9")return KeyBord.NumPad9;if (key == "NumAdd")return KeyBord.Add;if (key == "Num/")return KeyBord.Divide;if (key == "Num*")return KeyBord.Multiply;if (key == "Num-")return KeyBord.Subtract;if (key == "NumEnter")return KeyBord.Enter;if (key == "Num.")return KeyBord.OemPeriod;if (key == "NumLock")return KeyBord.NumLock;return KeyBord.T;}}
C#鼠标键盘操作用于桌面脚本相关推荐
- Selenium自动化测试-6.鼠标键盘操作
------·今天距2020年77天·------ 这是ITester软件测试小栈第59次推文 大家好 我是vivi小胖虎 作为测试 好像对于点点点这事一直放不下 如何让点点点变得更简单 让人变得更懒 ...
- 模拟鼠标键盘操作,含硬件模拟技术。[转]
模拟鼠标键盘操作,含硬件模拟技术. 键盘是我们使用计算机的一个很重要的输入设备了,即使在鼠标大行其道的今天,很多程序依然离不开键盘来操作.但是有时候,一些重复性的,很繁琐的键盘操作总会让人疲惫,于是就 ...
- python记录鼠标键盘操作自动执行重复工作
系列文章目录 文章目录 系列文章目录 前言 github项目原地址 一.执行方法 二.python录制 1.Frame1.py 2.KeymouseGo.py 三.说明书 KeymouseGo v2. ...
- 效率提升:使用AppleScript模拟鼠标键盘操作制作自动化工具
文章目录 前言 AppleScript的实践应用 实践:还原修饰键默认设置 AppleScript基础知识 1.基本模块 语法 变量和属性 类型转换 运算符 List(数组) Record(键值对) ...
- C# 模拟 鼠标 键盘操作
C# 模拟 鼠标 键盘操作 转载于:https://www.cnblogs.com/macT/p/10208222.html
- python截图工具和模拟鼠标键盘_python PyAutoGUI 模拟鼠标键盘操作和截屏功能
简介 一款跨平台/无依赖的自动化测试工具,目测只能控制鼠标/键盘/获取屏幕尺寸/弹出消息框/截屏. 安装 pip install pyautogui 鼠标键盘控制 >>> impor ...
- selenium自动化测试-鼠标键盘操作
前面我们已经学完了8种定位方式和利用Firefox插件协助定位,学会了定位了,自动化就成功了一半. 但是我们好像只是定位,定位后的操作并不多,我们今天要系统的了解下鼠标键盘操作. 回顾下我们之前的简单 ...
- PyMouse模拟鼠标键盘操作
PyMouse模拟鼠标键盘操作 使用PyMouse实现模拟鼠标键盘操作 -----解决方案1 1)安装[pyMouse]( https://pypi.org/project/PyMouse/) 2)安 ...
- python模拟按键包_今天玩点啥:利用python之PyUserInput实现模拟鼠标键盘操作,抢红包?聊天?自动下载?...
一.PyUserInput安装 python3.5的PyMouse和PyKeyboard模块都集成到了PyUserInput模块中.在python3.5中,直接安装PyUserInput模块即可 Py ...
最新文章
- dedecms嵌套栏目
- 【DIY】送给儿子的感应小夜灯,DIY小夜灯
- linux替换每个英文字开头为大写,shell脚本,文件里面的英文大小写替换方法。...
- 端计算(2)-android studio 的sdk,avd,grade及其它缓存配置
- BugkuCTF-WEB题file_get_contents
- @SpringBootApplication注解分析
- mysql主从复制及读写分离
- Java任务调度表达式,Java定时任务表达式,附带在线表达式生成器链接
- 【黑苹果教程】说点闲话
- 9.9 单片机蜂鸣器
- 搜索开启WPS功能的路由wash
- Unity做360度的全景照片
- 数图互通高校房产管理模块,公租房管理是怎样对合同、续租,申请审核审批管理的;
- 已解决Excel无法打开文件test.xIsx“,因为文件格式或文件扩展名无效。请确定文件未损坏,并且文件扩展名与文件的格式匹配。
- pycharm安装netmiko、xlwt
- java 线框图_你真的搞懂什么是线框图,什么是原型图了吗?
- 十分钟,让你了解DSP/DMP/SSP
- 计算机安全知识策划书,安全知识竞赛策划书模板
- 为什么www.52pjb.net总是不收录,最多只收录首页?
- 同济大学高等数学上册第四章不定积分以及每日一题