Switch off Mouse After Your Work….

Murali Dharan
2 min readDec 4, 2020

--

Very often i forget switching off the mouse after my work that the battery drains too fast, it is when i decided to go for a simple utility (in Python) which reminds me to switch off the mouse too whenever i shut down my system .

For this purpose, following two libraries are required which can be installed using pip utility from command prompt.

Eg: pip install <library name>

  1. shutdown — To shutdown the system.
  2. pyttsx3 — To remind the user with the remainder message to poweroff the Mouse.

Here is the Code..

Step1: import the required libraries :

from shutdown import *
import pyttsx3

Step2: Create a function which would read the text passed to it.

Step3: In the Main Program , invoke the function with remainder message and call the function for shutdown or hibernate the PC.

The Complete code is given below:

Complete Code

while the above program is to hibernate the PC, if you wish to shutdown or log off, you may try one of the following options.

Different Shutdown Options Available.

Step 4: Last but not the least, create a bat file for the above code and create a shortcut for the same in desktop, change the icon to your favourite one labelled as shutdown and double click for execution.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Murali Dharan
Murali Dharan

Written by Murali Dharan

A Passionate and Curious Programmer!!!!

Responses (2)

Write a response