# keepawake.ps1 # Simula attività spostando il cursore ogni 60 secondi Add-Type -TypeDefinition @" using System; using System.Runtime.InteropServices; namespace Win32 { public struct POINT { public int X; public int Y; } public static class NativeMethods { [DllImport("user32.dll")] public static extern bool SetCursorPos(int x, int y); [DllImport("user32.dll")] public static extern bool GetCursorPos(out POINT pt); } } "@ $interval = 60 # secondi Write-Host "KeepAwake avviato. Muovo il cursore ogni $interval secondi. Premi Ctrl+C per uscire.`n" while ($true) { $pt = New-Object Win32.POINT [Win32.NativeMethods]::GetCursorPos([ref]$pt) | Out-Null # muovi di 1 pixel e torna [Win32.NativeMethods]::SetCursorPos($pt.X + 1, $pt.Y) | Out-Null Start-Sleep -Milliseconds 100 [Win32.NativeMethods]::SetCursorPos($pt.X, $pt.Y) | Out-Null Start-Sleep -Seconds $interval }