Always "Available" in Microsoft Teams

After some minutes of inactivity, Microsoft automatically changes our state from “Available” to “Away”. There are some methods to avoid this, but in this case I will show how I do it by using the scripting language AHK

For example, one way to avoid this is by setting a status message, open the “Clear status message after” dropdown and set it to “Never”. However, people can see your custom status, so we will explain a stealthier method in here.

For that we will use AHK. From Wikipedia, AutoHotkey (or AHK) is “a free and open-source custom scripting language for Microsoft Windows, initially aimed at providing easy keyboard shortcuts or hotkeys, fast macro-creation and software automation that allows users of most levels of computer skill to automate repetitive tasks in any Windows application”.

To trick Microsoft Teams and always appear as “Available”, we will move the cursor every 30 seconds a tiny distance, so we will not detect it but Teams will.

Creating the script

For that we will use three AHK native functions:

  • MouseMove - Move the cursor 1 pixel in the X axis, 1 pixel in the Y axis, with a speed of 100 and with a movement relative to the current position.
  • Sleep - Wait 30.000 miliseconds or 30 seconds.
  • Loop - Create an infinite loop

The final script (script.ahk) is:

Loop
{
MouseMove, 1, 1, 100, R
MouseMove, -1, -1, 100, R
sleep, 30000
}

Running at startup

Finally, we can set this script to run at startup. For that, we will open the Shortcut folder by clicking Win+R and then running “shell:startup”:

Shortcut folder


Finally we create a shortcut of the file and copy it to this folder:

Shortcut file


Next time we restart the computer, this script will run automatically!

Written on August 24, 2021