3/23/2023 0 Comments Useful geektool scripts![]() ![]() She is an award-winning innovation leader, an author, and an international speaker. Vidhi Chugh is an AI strategist and a digital transformation leader working at the intersection of product, sciences, and engineering to build scalable machine learning systems. Your suggestions on automating more tasks using Python are welcome in the comments section below. I hope you enjoyed the three applications of Python in automating simple desktop tasks such as cleaning up any folder, downloading youtube videos, and automating the desktop. If you are keen to take it a notch ahead and learn more such examples, then refer to an excellent book “Automate the Boring Stuff with Python: Practical Programming for Total Beginners” by Al Sweigart. As evident from the examples shown in the post, you need not have extensive and advanced knowledge of Python programming to be able to implement such tasks. The post intends to share a host of tasks that can be automated on a daily basis and make our life easier. You can see the downloaded file in your Downloads folder. Please note that on a computer screen the 0,0 coordinates start from the top left corner with the y-axis values increasing as you move down and x-axis values increasing while moving rightwards. In this case, the coordinates are chosen as x = 150 and y = 150. Call the “doubleClick()” method with the coordinates of where you want to double-click as arguments. First, import the library “pyautogui” with the alias name “pag”. The below code types the text “This Desktop is Automated!” to the already open TextEdit file. Pyautogui is a Python library that supports the automation of mouse pointer movements and keyboard key presses without any hassle. ![]() Now that your Downloads folder is pristinely clean, let’s invite some ghosts to your desktop. The above code deletes all png and jpg files with filenames starting with “Whatsapp”. If file.startswith(("Whatsapp")) and file.endswith((“.png”, “.jpg”)): Loop through these files, verify if the files end with a “.pdf” extension, and remove the file using the ".remove(file)” method. Now call the “listdir()” function, which lists all the files and directories inside the current directory i.e. Change your directory to the Downloads directory. The library which supports this automation is “os”. Notably, this script removes all the suggested files instead of sending them to the Recycle Bin. ![]() Most commonly we end up downloading a lot of pdf files from the internet and thus the script shared below comes in handy to remove such files. ![]() Why not automatically delete some of the files, let’s say by type? We all have faced such a situation and struggle with manually deleting irrelevant files which are painstakingly difficult – is there a solution? Certainly. If you have been using your machine for a while now, there is a high chance you would have a messy Downloads folder. In this post, we are going to discuss three of the most useful applications of Python and its libraries to automate usual tasks on a desktop. Simple mundane tasks like responding to emails, downloading videos, sending text messages at a particular time of the day to a set of recipients, reading emails out loud, etc can be automated easily with the help of Python. As machine learning and AI become mainstream, it is widely getting prominence as it is straightforward to learn. When it comes to programming, Python is a much sought-after and easy-to-use language used for automating some of the repeated tasks. Humanity has reaped significant benefits and enjoyed ease by automating and delegating mundane tasks to machines. The world has always been automating something or the other, be it using simple machines, assembly lines, robots, or computers for processing transactions. Whether it's a ten-minute food delivery or ever-so-available content at on-demand services, we all are accustomed to getting things done at our fingertips. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |