Which tool to choose

To automate tasks on your computer, the combination is: an AI assistant that writes the script in Python, and Python installed on your machine to run it.

  • Tasks on files (renaming, moving, sorting, converting): Python is the choice, and every AI assistant writes it well.
  • Tasks on spreadsheets (Excel, CSV): again Python, which handles the tables without opening them by hand.
  • Tasks inside Google Sheets or Gmail: there a different language is better (Google's built-in scripting), the subject of other guides. For everything that lives in your local files, Python.

First thing: install Python from the official site (python.org). During the installation on Windows, tick the box "Add Python to PATH": skip this and the computer won't find Python afterward.

How to do it

The path diverges between Windows and Mac only in the command to run: where it changes, I'll point it out.

  1. Describe the task precisely. What's there at the start, what you want at the end, where the files are. Vague in, vague out.

  2. Ask the AI for the script. Specify that you want Python and that it should explain how to run it.

    The operating syntax:

    Write me a Python script that, in a folder I point it to, renames all the photos by adding the date they were modified in front of the name, in the format 2026-06-15. Leave the file extension unchanged. Before renaming, print the list of what it will do and ask me for confirmation. Explain to me step by step how to save it and run it on Windows and on Mac.
    
  3. Save the script. Copy the code into a text file and save it with the .py extension (for example rename.py), in the same folder or in a place you'll remember.

  4. Run it from the terminal.

    • On Windows: open the Command Prompt (search for "cmd" in the Start menu), move to the script's folder and type python rename.py.
    • On Mac: open the Terminal (search for "Terminal"), move to the folder and type python3 rename.py.
  5. Test first on a few copy files. Never run a script that modifies files directly on your originals the first time. Make a test folder with a few copies, run it there, check the result, then use it on the real files.

Here's a real, working script that counts and renames the files in a folder safely (first it shows what it will do, then it asks for confirmation):

import os
from datetime import datetime

# Change this path to your files' folder
cartella = "C:/Users/tuonome/Desktop/foto_prova"

file_list = [f for f in os.listdir(cartella) if os.path.isfile(os.path.join(cartella, f))]
print(f"Trovati {len(file_list)} file. Ecco cosa farò:")

rinomine = []
for nome in file_list:
    percorso = os.path.join(cartella, nome)
    data = datetime.fromtimestamp(os.path.getmtime(percorso)).strftime("%Y-%m-%d")
    nuovo_nome = f"{data}_{nome}"
    rinomine.append((percorso, os.path.join(cartella, nuovo_nome)))
    print(f"  {nome}  ->  {nuovo_nome}")

conferma = input("Procedo? Scrivi si per confermare: ")
if conferma.strip().lower() == "si":
    for vecchio, nuovo in rinomine:
        os.rename(vecchio, nuovo)
    print("Fatto.")
else:
    print("Annullato, nessun file modificato.")

A concrete example

Giulia downloads dozens of receipts every week with incomprehensible names. She needs to rename them with the date in front to find them again. She asks the AI for the script, saves it as rename.py. She first creates a test folder with five copies, points the script at it by changing the path, runs it from the terminal: the script shows the five planned renames and asks for confirmation. She checks, writes "si", and the files get renamed. Having verified that it works, she points it at the real folder. A half-hour-a-week job reduced to ten seconds.

When it does NOT work (and how to fix it)

If the terminal says that "python is not recognized"

Python isn't installed or wasn't added to the PATH during installation. Fix: reinstall Python from python.org remembering to tick "Add Python to PATH". On Mac, try python3 instead of python.

If the script gives an error with lots of red lines

It's an error message: it's scary but it's informative. Fix: copy the entire error message and paste it to the AI writing "I ran the script and it gives me this error, fix it". Often it's the wrong folder path: check that it exists and is written correctly.

If the script modifies the wrong files or deletes things

You pointed the script at the wrong folder, or it did more than expected. Fix: the golden rule is to always test on copies first. For operations that delete or overwrite, ask the AI to add a confirmation before acting and to print what it will do, like in the example script.

If the folder path isn't accepted

On Windows the slashes in paths cause confusion. Fix: use straight slashes / as in the example (C:/Users/...), not the backward ones, or ask the AI to handle the path you paste. Check that the folder really exists at that path.

A tip from someone who actually uses it

Always have the script do a dry run before the real run. A script that shows "here's what I would do" and waits for confirmation, before touching a single file, saves you from disasters. It's the difference between a tool that helps you and one that ruins your folder in a second. When you ask the AI for code, always ask for this safety net: print the actions, ask for confirmation, act only after. With data, you can never be too careful.

Frequently asked questions

Do I have to learn to code to use scripts?

No. You have to know how to describe the task, save a file and type a command in the terminal. The AI writes the code. Over time you'll learn to recognize the parts, but it isn't a prerequisite to start.

Is it dangerous to run code written by AI?

It is if you launch it blindly on important files. A script can delete or overwrite. There's only one rule: always test on copies, and for destructive operations demand a confirmation in the code. With this caution, it's as safe as any program.

Can I have a script run automatically at a certain time?

Yes: both Windows and Mac have tools to run a program at set times. Ask the AI: "How do I run this script automatically every Monday at 9 on Windows (or Mac)?" and it will guide you through the configuration.

Is it worth automating any boring task?

No, and this is where judgment comes in. Automating is worth it when the task is repetitive, frequent and always done the same way. For something you do once in a while, writing and testing a script costs more than the work by hand. The question isn't "can it be automated?", it's "how many times will I do it again?". Automate what you repeat often; do the rest by hand and save yourself the effort of building the tool.