1、首先,用到的库是AutoItLibrary,用到的方法是send;按F5可用看到 2、demo 看demo,很简单,打开百度,输入内容查找,只要是看send 第4行:意思是指全选操作,即我们平时的Ctrl+a 第5行:把全选的内容进行一次复制ctrl+c 第6行:进行粘贴ctrl+v 3、win切换窗口(键盘按下alt,操作tab键) 操作步骤如下: AutoITLibrary.send {ALT DOWN} AutoITLibrary.send {tab} AutoITLibrary.send {tab} AutoItLibrary.Send {ALT UP}
其它键盘操作,请参考: 键盘输入 [Arguments] ${keys} ${flag}=0 [Documentation] 模拟键盘输入,需要两个参数: ... 第一个参数: 需要输入的键盘按键 ... 第二个参数: 标记变量,可选值,默认为0, ... 0: 代表第一个参数${keys}中的!+^#代表特殊按键 ... 1: 代表第一个参数${keys}中的所有字符都是普通字符串 ... 举例: ... ^a^c^v!{F4} 代表:Ctrl+a Ctrl+c Ctrl+v Alt+F4 ... 关于特殊按键的说明: ... 如果${flag}为0,则: ... ! 代表ALT按键 ... + 代表SHIFT按键 ... ^ 代表CTRL按键 ... # 代表WIN按键 ... 比如:!+a 代表:ALT+SHIFT+a ... 其他特殊按键: ... ${flags}为0的时候,还支持下述特殊按键: ... 输入 最终的键盘按键 ... {!} ! ... {#} # ... {+} + ... {^} ^ ... {{} { ... {}} } ... {SPACE} SPACE ... {ENTER} ENTER key on the main keyboard ... {ALT} ALT ... {BACKSPACE} or {BS} BACKSPACE ... {DELETE} or {DEL} DELETE ... {UP} Cursor up ... {DOWN} Cursor down ... {LEFT} Cursor left ... {RIGHT} Cursor right ... {HOME} HOME ... {END} END ... {ESCAPE} or {ESC} ESCAPE ... {INSERT} or {INS} INS ... {PGUP} PageUp ... {PGDN} PageDown ... {F1} - {F12} Function keys ... {TAB} TAB ... {PRINTSCREEN} Print Screen key ... {LWIN} Left Windows key ... {RWIN} Right Windows key ... {NUMLOCK on} NUMLOCK (on/off/toggle) ... {CAPSLOCK off} CAPSLOCK (on/off/toggle) ... {SCROLLLOCK toggle} SCROLLLOCK (on/off/toggle) ... {BREAK} for Ctrl+Break processing ... {PAUSE} PAUSE ... {NUMPAD0} - {NUMPAD9} Numpad digits ... {NUMPADMULT} Numpad Multiply ... {NUMPADADD} Numpad Add ... {NUMPADSUB} Numpad Subtract ... {NUMPADDIV} Numpad Divide ... {NUMPADDOT} Numpad period ... {NUMPADENTER} Enter key on the numpad ... {APPSKEY} Windows App key ... {LALT} Left ALT key ... {RALT} Right ALT key ... {LCTRL} Left CTRL key ... {RCTRL} Right CTRL key ... {LSHIFT} Left Shift key ... {RSHIFT} Right Shift key ... {ALTDOWN} Holds the ALT key down until {ALTUP} is sent ... {SHIFTDOWN} Holds the SHIFT key down until {SHIFTUP} is sent ... {CTRLDOWN} Holds the CTRL key down until {CTRLUP} is sent ... {LWINDOWN} Holds the left Windows key down until {LWINUP} is sent ... {RWINDOWN} Holds the right Windows key down until {RWINUP} is sent ... {ASC nnnn} Send the ALT+nnnn key combination AutoItLibrary.Send ${keys} ${flag}
键盘输入Alt+F4 AutoItLibrary.Send !{F4}
键盘输入Ctrl+Space AutoItLibrary.Send ^{SPACE}
键盘输入Ctrl+a AutoItLibrary.Send ^a
键盘输入Ctrl+c AutoItLibrary.Send ^c
键盘输入Ctrl+v AutoItLibrary.Send ^v
键盘输入Ctrl+s AutoItLibrary.Send ^s
键盘输入Ctrl+p AutoItLibrary.Send ^p
键盘输入Ctrl+Home AutoItLibrary.Send ^{HOME}
键盘输入Ctrl+End AutoItLibrary.Send ^{END}
键盘输入Win+d 键盘输入 {LWINDOWN}d{LWINUP}
键盘输入Win+r 键盘输入 {LWINDOWN}r{LWINUP}