Code:
cls
Write-Host"Anti-AFK-Script"
$wshell = New-Object -ComObject wscript.shell;
$i = 0
$intervall = 300
While($True) {
$i++
Write-Progress -Activity "Next key hit" -SecondsRemaining ($intervall-$i) -Status " "
$host.ui.RawUI.WindowTitle = "$($intervall-$i) seconds left..."
if($i -eq $intervall) {
$wshell.SendKeys('^')
$i = 0
}
Sleep 1
}
Note: At the first run, PowerShell might ask you if you really want to execute the script (Windows default security settings...). You should of course select Yes here.