Caffeine Hack - Got caught with Caffeine installed
Hack
Click Start, then type Powershell
and it should show up.
Type notepad $profile
to open your default profile.
This will likely be blank if this is the first time doing this.
Paste the following code:
function idle { $wshell = New-Object -ComObject wscript.shell; "Press CTRL+C to cancel." while ($true) { $wshell.SendKeys('+') Sleep 60 } }
Close Powershell, then re-open it (see step one).
Type idle
and hit enter.
This function just presses the shift key every minute. It's less intrusive than mouse wigglers..
Updated Version
Save this to your profile, and then you can run it indefinitely using idle
or set a duration in minutes by adding it at the end idle 28800
.
You can even have it do the math for you. So 60 mins * 8 hours would be idle (60*8)
.
You can get even fancier if you know what time you need to clock out.
# If you stop working at 5pm (17:00) then you could use this: $peaceout = (get-date 17:00) idle ($peaceout - (get-date)).TotalMinutes
This part goes in your profile. Remember, if you make changes to your profile you will need to close and reopen any PowerShell terminals for them to pick up the changes.
function idle { param( [int]$Duration = -1 # Duration in Minutes ) $wshell = New-Object -ComObject wscript.shell; 'Press CTRL+C to cancel.' $idle = $true while ($idle) { $wshell.SendKeys('+') if ($Duration -eq 0) { $idle = $false 'Time Expired.' break } elseif ($Duration -gt 0) { write-host -NoNewline "`r$Duration min(s) remaining." $Duration-- } Start-Sleep 60 } }