Initial situation
I'm working with multiple workstations on a domain where I'm not allowed to change screensaver or power saving options which is very common nowadays. I often have to switch between PCs and they get locked after 10 idle minutes. Horrible.
Currently I'm using caffeine to prevent screensaver and system lock. But this leads to the problem that my PCs are connected to the network 24/7 all the time. Even at night when I manually have locked all my workstations with Win+L.
What I want to achieve
My idea is to automate these four tasks with AutoIt or AutoHotKey and trash all 3rd party software
- Disable a specific network interface once when system is locked and time is between 8 pm and 6 am
- Re-enable a specific network interface once when system is unlocked
- Ping a specific IP when system is not locked (this is for keeping a firewall open)
- Simulate a keypress once every minute so the system won't lock the screen or activate the screensaver
What I have tried so far
Since SU isn't about Give me the code, I started googling around for a way to determine a safe way if Windows is locked. It turns out that using WinExist("A")
isn't reliable enough and I'm stuck.
Second, I know I can simulate a keypress in a loop but I don't know which key I should use, that doesn't accidentally opens or executes something.