python pyautogui 常用指令

import pyautogui
import time

pyautogui.PAUSE = 1
pyautogui.FAILSAFE = True

#查当前系统分辨率
# width, height = pyautogui.size()
# print(width, height)

#鼠标从像素100,100开始左上角正方形移动
# for i in range(5):
#     pyautogui.moveTo(100, 100, duration=0.25)
#     pyautogui.moveTo(200, 100, duration=0.25)
#     pyautogui.moveTo(200, 200, duration=0.25)
#     pyautogui.moveTo(100, 200, duration=0.25)

#鼠标从当前位置正方形移动
# for i in range(3):
#     pyautogui.moveRel(100, 0, duration=0.25)
#     pyautogui.moveRel(0, 100, duration=0.25)
#     pyautogui.moveRel(-100, 0, duration=0.25)
#     pyautogui.moveRel(0, -100, duration=0.25)

#获取当前鼠标位置
# print(pyautogui.position())


#找鼠标当前位置
# print('Press Ctrl-C to quit.')
# try:
#     while True:
#         x, y = pyautogui.position()
#         positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
# except KeyboardInterrupt:
#     print('\nDone.')
#     print(positionStr, end='')
#     print('\b' * len(positionStr), end='', flush=True)

#鼠标左击left, 右击right, 中键middle
# pyautogui.click(524, 70, button="left")
#pyautogui.rightClick() 和pyautogui.middleClick() 函数将分别执行双击右键和双击中键

#向下滚动,负数是向下,正的向上
# pyautogui.scroll(-600)

#九阴按键

while True:  
    time.sleep(0.5)
    pyautogui.press("tab")
    time.sleep(0.5)
    pyautogui.click(725, 640, button="left")
    time.sleep(0.5)
    pyautogui.click(497, 645, button="left")
  # time.sleep(0.5)
   # pyautogui.click(537, 645, button="left")
   # time.sleep(0.5)
    #pyautogui.click(672, 648, button="left")
    
# 输出字符
# # pyautogui.typewrite("hello")
# time.sleep(2)
# pyautogui.click(457, 445, button="left")
#
# # #组合键
# pyautogui.hotkey("ctrlleft", "1")


#常用字符
# a', 'b', 'c', 'A', 'B', 'C', '1', '2', '3',
# '!', '@', '#',等等单个字符的键
# 'enter'(or 'return' or '\n')  回车键
# 'esc' Esc 键
# 'shiftleft', 'shiftright'  左右 Shift 键
# 'altleft', 'altright'  左右 Alt 键
# 'ctrlleft', 'ctrlright'  左右 Ctrl 键
# 'tab'(or '\t')  Tab 键
# 'backspace', 'delete'  Backspace 和 Delete 键
# 'pageup', 'pagedown'  Page Up 和 Page Down 键
# 'home', 'end'  Home 和 End 键
# 'up', 'down', 'left', 'right'  上下左右箭头键
# 'f1', 'f2', 'f3',等等  F1 至 F12 键
# 'volumemute', 'volumedown', 'volumeup'
# 静音、减小音量、放大音量键(有些键盘没有这些键,但你
# 的操作系统仍能理解这些模拟的按键)
# 'pause'  Pause 键
# 'capslock', 'numlock', 'scrolllock'  Caps Lock,Num Lock 和 Scroll Lock 键
# 'insert'  Ins 或 Insert 键
# 'printscreen'  Prtsc 或 Print Screen 键
# 'winleft', 'winright'  左右 Win 键(在 Windows 上)

你可能感兴趣的:(python,笔记,python)