Python Automation Ideas – Beginners Level

As a python enthusiast or as a python student you would be looking for ideas which you can automate. So in this article, we are going to discuss Python automation ideas for beginners with examples. These ideas or projects are like building blocks for other advanced automation projects.

Readers can continue scrolling down whereas video lovers can watch this video.

Idea 01 – Prevent Windows Screen Locks using Python Program using Python pyautogui

This is a simple python program which you can use to prevent screen locks. This can be very useful scripts in the situation when you are uploading big files and you have fear that screen will get locked and your uploads will be stopped etc.

Installing PyAutoGUI

You need to install pyautogui module in order to run this program. You can use pip to install pyautogui by running “pip install pyautogui” command. Below is the python program to achieve screen lock prevention.

import pyautogui
import time

while True:
    time.sleep(5)
    pyautogui.press('volumeup')
    pyautogui.press('volumedown')

Idea 02 – Automate Hit The Dot Game Using Python Program using Python pyautogui

Hit the dot is pretty simple program which can be played here manually. If you look at the program than there are three steps which has to be performed while playing the game:

  1. Identifying the checked box
  2. Moving your mouse position to the highlighted box
  3. Click

Now our aim is to automate all these three steps which can be achieved by below code:

import pyautogui
import keyboard
import time


time.sleep(3)

while keyboard.is_pressed('q') == False:
# Match Highlighted Image anywhere on the screen with pyautogui.locateCenterOnScreen
    loc = pyautogui.locateCenterOnScreen('C:\\Users\\USER\\Documents\\dot.png')
    pyautogui.moveTo(loc)
    pyautogui.click()

Code Explanation

We are importing three modules in this program as we will need all of them for various purposes in our code. Notice that we running an infinite loop and it only gets out of the loop if we press “q” from the keyboard.

We are using pyautogui.locateCenterOnScreen() to search for matching image on entire screen. Please note that you will have to save the image and provide the complete location of the saved image as an argument to pyautogui.locateCenterOnScreen() method. After matching the image this method will return x and y position of the center of the matched image. So once we know the location, we just want to move the mouse cursor to that location and for that we are using pyautogui.moveTo() function and passing the location as an argument.

Idea 03 – Automate Youtube Comments using Python pyautogui

We can break down this problem into following steps:

  1. Identify Like Button of any comment
  2. Move Mouse Pointed to Like Button
  3. Click On the Button
  4. Scroll Down to Move onto Next comment

Here is the code which can help us to automate all of these steps. The first three steps are pretty much the same as we have followed in the “Hitting the Dot” program. To scroll down or scroll up we can use pyautogui.scroll() method. In this method, we need to specify how many clicks we want to move down or up. You can try running this program and adjust the click value as per your screen.

import pyautogui
import keyboard
import time

time.sleep(3)

while keyboard.is_pressed('q') == False:
    loc = pyautogui.locateCenterOnScreen('C:\\Users\\USER\\Documents\\like.png', region=(30,200,100,50))
    pyautogui.moveTo(loc)
    # pyautogui.click()
    pyautogui.scroll(-30)
    time.sleep(0.05)

Learn more python automation from from posts

Automate Sending Whatsapp Messages with Python

Automate Typeracer Game

Comments are closed.

Scroll to Top