pyautogui はマウスの位置,クリック,キーボード入力などができる.さらに画像マッチングによりアイコンの位置を取得できる.
pyperclipはクリップボードに文字列を入力できる.
サンプルコード
hello_autogui.py
import pyautogui as pg
import pyperclip as pc
import time
# for i in range(1,100):
posx,posy = pg.position()
print(posx,posy)
time.sleep(0.01)
# pg.click(x=posx, y=posy, button="left")
# pg.typewrite("hello pyautogui!")
# pg.hotkey("ctrl","a")
# pg.hotkey("ctrl","c")
# pg.hotkey("ctrl","v")
# pg.hotkey("ctrl","v")
# pg.hotkey("Enter")
# pc.copy("どうもこんにち は!")
# pg.hotkey("ctrl","v")
# #image process
img = "target.png"
sc = pg.screenshot()
sc.save("sss.png")
locx, locy = pg.locateCenterOnScreen(img)
print(locx,locy)
pg.click(x=locx, y=locy, button="right")
さて何につかおうか...
参考