Created
March 5, 2020 20:47
-
-
Save pakoy3k/67134af46b88846435f8c4de6ff52bce to your computer and use it in GitHub Desktop.
Toma un Screenshot busca el icono de Chrome, mueve el mouse a su posición y da click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pip install pyautogui | |
#pip install opencv-python | |
#pip install pyscreenshot | |
import pyscreenshot as ImageG | |
import pyautogui as Mouse | |
import cv2 | |
if __name__ == '__main__': | |
imagen = ImageG.grab() | |
imagen.save('screenshot.png') | |
method = cv2.TM_SQDIFF_NORMED | |
image2Find = cv2.imread('toFind.png') | |
screenshot = cv2.imread('screenshot.png') | |
result = cv2.matchTemplate(image2Find, screenshot, method) | |
mn,_,mnLoc,_ = cv2.minMaxLoc(result) | |
MPx,MPy = mnLoc | |
Mouse.moveTo(MPx,MPy,2,Mouse.easeInQuad) | |
Mouse.click() | |
#-# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment