from pynput import mouse
from pynput.mouse import Button,Controller
import time
#本脚本的坐标是(710, 52),右上角gitr 输入点位是(1717, 161)
#control = mouse.Controller()
#print(control.position)
mouse = Controller()
# Set pointer position
mouse.position = (1717, 161)
print('Now we have moved it to {0}'.format(mouse.position))
# Double click; this is different from pressing and releasing
# twice on Mac OSX
mouse.click(Button.left, 2)
from pynput.keyboard import Key,Listener,Controller
# Type 'Hello World' using the shortcut type method
keyboard = Controller()
keyboard.type(' git add .\r')
time.sleep(3)
# Type 'Hello World' using the shortcut type method
keyboard = Controller()
keyboard.type('git commit -m "mm" \r')
#将鼠标返回开始处,保证操作连贯
mouse.position = (710, 52)
具体api可以参照下面这个链接:
http://pythonhosted.org/pynput/index.html