__author__ = 'Administrator'
from pykeyboard.windows import PyKeyboard
from pymouse.windows import PyMouse
import time
kb = PyKeyboard()
#kb.press_key(kb.windows_l_key)
#kb.release_key(kb.windows_l_key)
'''
kb.press_key(kb.alt_key)
kb.press_key(kb.insert_key)
kb.release_key(kb.insert_key)
kb.release_key(kb.alt_key)
time.sleep(2)
'''
k = PyKeyboard()
k.press_key(k.windows_l_key)
#k.press_key('r')
#k.release_key('r')
k.tap_key('r')
k.release_key(k.windows_l_key)
time.sleep(2)
k.type_string('notepad.exe')
k.press_key(k.enter_key)
k.release_key(k.enter_key)
time.sleep(2)
# pressing a key
k.press_key('H')
# which you then follow with a release of the key
k.release_key('H')
# or you can 'tap' a key which does both
k.tap_key('e')
# note that that tap_key does support a way of repeating keystrokes with a interval time between each
k.tap_key('l',n=2,interval=1)
# and you can send a string if needed too
k.type_string('o World!')
python控制用户输入
最新推荐文章于 2024-07-17 22:35:51 发布