0
2

More than 3 years have passed since last update.

僕のpyautogui(Python)

Last updated at Posted at 2019-12-13

自分用のまとめ
随時更新

自分がわかればいいからところどころ用語が間違ってるかも

!見方

#コマンド
    #引数のオプションの説明

pyautoguiって何に使うの?

なんちゃってRPA作るときとか。

PCの自動操縦

モジュール読み込み

import pyautogui as auto

頻出操作

マウス操作
#マウス移動
auto.moveTo(x,y)
   #x座標,y座標に移動

#クリック
auto.click()
    #引数に座標を渡すとそこをクリック

#右クリック
auto.rightClick()
     #引数に座標を渡すとそこを右クリック

#スクロール
auto.scroll()
画像認識
#画像の中心位置を取得
auto.locateCenterOnScreen()
    #引数に画像
    grayscale=True  #画像をグレースケールで認識

#画像の有無を取得(の時に使う)
l = auto.locateOnScreen()
#locateOnScreenの返り値の中心をとる
auto.Center(l)
キーボード操作
#キー押しっぱなし
auto.keyDown()

#キー離す
auto.keyUp()

#キー押す
auto.press()

#複数のキーを押す
auto.hotkey()

#文字の入力
auto.typeWrite()  #なぜかうまくいかないことが多いからあんま使わない。
    #引数に打ち込む文字

#文字入力の代替案
pyperclip.copy()
auto.hotkey('ctrl','v')


0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2