Python libraries that you can control other programs like Mind stone of the Avenger

Tanakan Chua
4 min readNov 25, 2018

--

Today, I am going to share some Python libraries which help us to do repeating (or boring) tasks on computer. The first time I knew this, my feeling was like I had the power of mind stone. [In case, someone who doesn’t know what the mind stone is. In the Avenger, the mind stone can manipulate other minds or is a power source of android robot namely Vision.]

https://screenrant.com/infinity-war-mind-stone-secrets-facts-trivia/

In fact, I came across these libraries because at first, I just wanted to learn about data sciences. At this moment, the most two popular programming languages certainly is R and Python. I started with R and I found out the limitation of deployment even though I admitted that R is a quite easy programming language. Therefore, I have continued with Python for the sake of data science purpose and the popular libraries are Pandas and Numpy. However, I discovered that there are many Python libraries for many purposes. I would like to share the libraries having abilities as I bragged above Hahaha.

  1. openpyxl

Excel is the most popular program that employees use everyday. Openpyxl can not only control your excel both read and write but also to create chart as well. Imagine that if you have to do repeating tasks every week. For example, you have to fill in sales records of each zone in to summary sheet and then create some reporting charts. If you are too tried to do this every week, you can have Openpyxl help you to do this like the robot arm. After setting it one, you will be free from this task forever.

I would leave the good learning source in the below.

2. pptx

Now, you have the ability to can control the Excel. you may want to control the other popular program “Powerpoint”. PPTX helps you create slides from scratch. you can create boxes, insert pictures and whatever you want. Again, you can follow the link below step by step which is quite easy.

3. win32com

This library can access to many programs. I have tried with Excel, Powerpoint and Outlook. you may dough that why I need this library if I have above libraries. Me too haha. At first, I used only openpyxl but I found its limitation that openpyxl cannot create shape objects. However, win32com can deal with this problem. Besides, win32com can link Excel and Powerpoint together. For example, after updating charts in Excel and want to copy and paste it as picture to Powerpoint, win32com also do the great job about this. The disadvantages I found out is that after win32com accessing to Excel and Powerpoint, it starts these programs automatically which may disturb you a bit. Nevertheless, combining of these 3 libraries will help you a master of control.

There are many source separately about win32com. Next time (or I have time Haha) I will share the full code link 3 libraries together

4. pyautogui

I call pyautogui the ultimate library. Why? … It can control you keyboard and mouse. you can automatically move you mouse to anywhere to click, right click, double click, drag. Moreover, it also can move to a position that shows a picture or an icon that we specify. So, if the 3 above libraries cannot help you find the solution, I hope this one can. However, as it is the ultimate, it will have aftershock effect (for gamer will know Haha) which is you cannot use your computer during its operation because your mouse is under controlled by pyautogui. The link below explains well of this library.

Finally, in my opinion, all 4 libraries will help you like you have the power mind stone. But you may think that the Avenger has 6 infinity stones. How the other stone are comparing to the stuff like this. Indeed, you can follow my time stone story as the link below. So right now, we have 2 infinity stones already. I will try to find the other stones and share with you next time.

--

--