i am the funny
 

 I AM THE FUNNY!!!

This one is just a PowerShell script that can replace the Caffeine program. The program sends a simulates a key being pressed to stop the screen going to sleep, and for most networked PCs, locking the screen. The only problem is that you need to remember to lock your screen when you go away from your PC, otherwise your colleagues will now doubt have fun with your unlocked PC.

The basic program is below. This will run for 60 minutes and every 60 seconds press a key.

param($minutes = 60)

$myshell = New-Object -com "Wscript.Shell"

for ($i = 0; $i -lt $minutes; $i++) {
 Start-Sleep -Seconds 60
 $myshell.sendkeys(".")
}


And then I realised, I can do more unnecessary stuff in this script... BECAUSE OF REASONS!!! Nothing malicious though. That comes later!
This script will run forever... and by forever I mean unitl you close the window or restart your computer.

#------------------------------------------------------------------
# Clear the screen
#------------------------------------------------------------------
CLS
#------------------------------------------------------------------
# Changes the size of the powershell window
#------------------------------------------------------------------
$pshost = Get-Host # Get the PowerShell Host.
$pswindow = $pshost.UI.RawUI # Get the PowerShell Host's UI.

$newsize = $pswindow.windowsize # Get the UI's current Window Size.
$newsize.width = 24 # Set the new Window Width to 24 columns.
$newsize.height = 2 # Set the new Window Height to 2 rows.
$pswindow.windowsize = $newsize # Set the new Window Size as active.

$newsize = $pswindow.BufferSize # Get the UI's current Buffer Size.
$newsize.width = 24 # Set the new buffer's width to 24 columns.
$newsize.height = 2 # Set the new buffer's height to 2 rows.
$pswindow.buffersize = $newsize # Set the new Buffer Size as active.

#------------------------------------------------------------------
# Where the magic happens
#------------------------------------------------------------------
$myshell = New-Object -com "Wscript.Shell"

Write-Host 'Toggle with F12 to exit.'

$continue = $true
while($continue)
{
# press F12 to escape the loop ... or just close the screen
if ([console]::KeyAvailable)
 {
  
$x = [System.Console]::ReadKey()
  
  
switch ( $x.key)
  {
   
F12 { $continue = $false }
  }
 }
else
 {
  
Start-Sleep -Seconds 60
  
$myshell.sendkeys("{F15}")
 }
}