DEV Community 👩‍💻👨‍💻

kayYOLO
kayYOLO

Posted on

[Python]Keep MS Teams status active

Microsoft Teams will auto-offline without action from your mouse and keyboard for a while. So we can use Python to control the mouse and keyboard to keep moving.
Clicknium is a Python Library that can control your mouse and keyboard.

install

pip install clicknium

Python script

from time import sleep
import math
from clicknium import clicknium as cc
def circle():
    a,b = cc.mouse.position()
    w = 20  
    m = (2*math.pi)/w 
    r = 200      

    while 1:    
        for i in range(0, w+1):
            x = int(a+r*math.sin(m*i))  
            y = int(b+r*math.cos(m*i))
            cc.mouse.move(x,y)
            sleep(0.2)

if __name__ == "__main__":
    circle()
Enter fullscreen mode Exit fullscreen mode

The above code will keep moving your mouse along a circle. You can stop it by `Ctrl+C.

There are a lot of things that you can use Clicknium to achieve and it is quite easy. It can control the mouse and keyboard, automate desktop applications and web browsers. Follow the Clicknium quick start and turn your routine work into an automation workflow.

Top comments (0)

Update Your DEV Experience Level:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠