There is more to life with TurboRenault.co.uk

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

5 GT Turbo My little 5

Left it playing to stop the monitor at work locking
Copy the below into notepad

Save it as "MM2.ps1" on your desktop

Right click the saved file, hit [Open with Powershell]

The powershell window will open and double tap the scroll lock button every few mins for you. Keeps the screen awake and keeps Teams on green/red.


#
# -- NoSleep --
# Keep your computer awake by programmatically pressing the ScrollLock key every X seconds
#

param($sleep = 240) # seconds
$announcementInterval = 10 # loops

Clear-Host

$WShell = New-Object -com "Wscript.Shell"
$date = Get-Date -Format "dddd MM/dd HH:mm (K)"

$stopwatch
# Some environments don't support invocation of this method.
try {
$stopwatch = [system.diagnostics.stopwatch]::StartNew()
} catch {
Write-Host "Couldn't start the stopwatch."
}

Write-Host "Executing ScrollLock-toggle NoSleep routine."
Write-Host "Start time:" $(Get-Date -Format "dddd MM/dd HH:mm (K)")

Write-Host "<3" -fore red

$index = 0
while ( $true )
{
Write-Host "< 3" -fore red # heartbeat
$WShell.sendkeys("{SCROLLLOCK}")

Start-Sleep -Milliseconds 200

$WShell.sendkeys("{SCROLLLOCK}")
Write-Host "<3" -fore red # heartbeat

Start-Sleep -Seconds $sleep

# Announce runtime on an interval
if ( $stopwatch.IsRunning -and (++$index % $announcementInterval) -eq 0 )
{
Write-Host "Elapsed time: " $stopwatch.Elapsed.ToString('dd\.hh\:mm\:ss')
}
}


1732542292828.webp
 
Copy the below into notepad

Save it as "MM2.ps1" on your desktop

Right click the saved file, hit [Open with Powershell]

The powershell window will open and double tap the scroll lock button every few mins for you. Keeps the screen awake and keeps Teams on green/red.


#
# -- NoSleep --
# Keep your computer awake by programmatically pressing the ScrollLock key every X seconds
#

param($sleep = 240) # seconds
$announcementInterval = 10 # loops

Clear-Host

$WShell = New-Object -com "Wscript.Shell"
$date = Get-Date -Format "dddd MM/dd HH:mm (K)"

$stopwatch
# Some environments don't support invocation of this method.
try {
$stopwatch = [system.diagnostics.stopwatch]::StartNew()
} catch {
Write-Host "Couldn't start the stopwatch."
}

Write-Host "Executing ScrollLock-toggle NoSleep routine."
Write-Host "Start time:" $(Get-Date -Format "dddd MM/dd HH:mm (K)")

Write-Host "<3" -fore red

$index = 0
while ( $true )
{
Write-Host "< 3" -fore red # heartbeat
$WShell.sendkeys("{SCROLLLOCK}")

Start-Sleep -Milliseconds 200

$WShell.sendkeys("{SCROLLLOCK}")
Write-Host "<3" -fore red # heartbeat

Start-Sleep -Seconds $sleep

# Announce runtime on an interval
if ( $stopwatch.IsRunning -and (++$index % $announcementInterval) -eq 0 )
{
Write-Host "Elapsed time: " $stopwatch.Elapsed.ToString('dd\.hh\:mm\:ss')
}
}


View attachment 221071
Thanks for that but I have absolutely no idea what any of that means
Apart from our diagnostic gear I’m a computeraphobe
After 29 years on the floor I took the workshop controller job and I’m slowly learning the pc
Ido know that we are not allowed to remove the screen lock function as I asked a few years back and was told it was mandatory
 
Back
Top