• Limonene@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    4 hours ago

    I was getting marked as “away” in Microsoft Teams every day, even though I was working. I just wasn’t using Microsoft Teams, so it marked me as idle.

    I wrote this Autohotkey script after my boss started complaining. It clicks on Teams every 2 minutes:

    global running := 0
    
    ^+1::
    {
    	global running := 1
    	while running == 1
    	{
            CoordMode("Mouse", "Screen")
            oldx := 0
            oldy := 0
            MouseGetPos(&oldx, &oldy)
            prev_active := WinActive("A")
    
            Try
            {
                WinActivate("ahk_class TeamsWebView")
            }
            Catch TargetError as e
            {
            }
            CoordMode("Mouse", "Window")
            Send("{Click 80 40 Left}")
    
            Try
            {
                WinActivate("ahk_id " prev_active)
            }
            Catch TargetError as e
            {
            }
            CoordMode("Mouse", "Screen")
            MouseMove(oldx, oldy, 0)
    
            sleep(115000)
    	}
    }
    
    ^+2::
    {
    	global running := 0
    }
    
    

    It has the side effect of preventing my computer from entering screensaver/lock screen when I really am away.