Skip to content

Automating Desktop Applications

  1. open app
  2. focus window
  3. navigate with hotkeys
  4. use image locate for buttons
  5. add safe delays
desktop_automation_skeleton.py
import time
import pyautogui
 
 
def main():
    pyautogui.alert("Move mouse to top-left anytime to STOP", title="Safety")
 
    # TODO: open your app manually first
    time.sleep(2)
 
    # Example actions:
    # pyautogui.hotkey("ctrl", "l")
    # pyautogui.write("hello")
    # pyautogui.press("enter")
 
 
if __name__ == "__main__":
    main()

If an app provides an API or CLI, use that instead.

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading