Automating Desktop Applications with Python

Automating Desktop Applications with Python

This tutorial follows on from last week’s automating web browsers with Python. If you have not seen that one yet, you can check it out at the following link:

The same as last week, I’m going to be using Visual Studio to write the program, but you can use any text editor of your choosing. Just remember to say the file with the .py extension, so that your machine will run it as a Python executable.

To begin with, we need to import the ‘os module’. The module gives access to Operating System functionality and allows the opening of programs.

Import os

Once the ‘import os’ command has been written, there is only one more command left to write and that is ‘os.system(‘start <application_name>’)

This command can be written as many times as needed, just by changing the application name to something different.


In the end, this program was relatively simple to write. However, it did cause my quite a bit of frustration trying to figure out the syntax needed for the program to run correctly. I have added the code from this program to what I wrote last week to setup an automated link on my desktop, so that it will run with a double-click of the mouse.

Completed Work Flow

This can be expanded on further still by allowing the newly created application to run on start-up.

In the bottom left-hand corner of your keyboard near the ‘ctrl’ key, should be ‘Windows flag’ also known as the ‘Super-user key’ in Linux. Press the Windows Key and the letter ‘R’ at the same time. This will open a tab called ‘run’.

Type: shell:startup

Run Command

In the window that opens, copy and paste the newly saved Python program to that location. This should then run every time the machine is booted up.

File location for Python Program start-up

To stop the file from running at start up, delete the file from that location. Alternatively, open Task Manager using Ctrl + Alt + Delete and navigate to the ‘Start-up’ items. The program should be listed, right-click on the item to enable or disable it.

Start-up items

Finally, save all your work and reboot the machine to test it works when the machine boots up.

Congratulations, you have just created your first automated setup using Python Programming.

Published by Daniel Wray

IT Support Engineer; Studying for CompTIA Network+. 100 Days of Python Challenge. Aspiring blogger. Passion for Learning and Teaching!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: