Skip to content

kcall174/pyautogui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Automation with PyAutoGUI

note: user can force pyautogui to stop running by moving the mouse to a corner of the screen

Install PyAutoGUI

pip3 install pyautogui

Import pyautogui

import pyautogui

Move mouse in a square - here we iterate 100 times (user can change amount)

for i in range(100): 
    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)
    

Adding Single Mouse Clicks

import pyautogui
import threading
import datetime

screenSize= pyautogui.size() # get screensize

def moveMouse(): 
    pyautogui.moveTo95, screenSize[1], duration = 1
    
def clickMouse():
    pyautogui.click()
    main()
    
def main():
    hour = datetime.datetime.now().hour
    if hour == 17 or hour == 12:
        print('end of day reached')
        quit()
        
    else: 
        threading.Timer(5.0, moveMouse).start()
        threading.Timer(10.0, clickMouse).start()
        
main()

Releases

No releases published

Packages

No packages published

Languages