Skip to content

Instantly share code, notes, and snippets.

@kskmori
Created October 18, 2023 05:06
Show Gist options
  • Save kskmori/7131d2bb513483a3c388dfa8b56fc7e6 to your computer and use it in GitHub Desktop.
Save kskmori/7131d2bb513483a3c388dfa8b56fc7e6 to your computer and use it in GitHub Desktop.
@powershell -NoProfile -ExecutionPolicy Unrestricted "&([ScriptBlock]::Create((cat \"%~f0\" | ?{$_.ReadCount -gt 1}) -join \"`n\"))" %* & goto:eof
$Signature = @'
[DllImport("user32.dll")]
public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
'@
$MouseEvent = Add-Type -MemberDefinition $Signature -Name "Win32MouseEvent" -Namespace Win32Functions -PassThru
echo "ASSaver.ps1 started."
echo "[Ctrl+C] Press to exit."
while ($true) {
Start-Sleep -s 50
$MouseEvent::mouse_event(1, 0, 0, 0, 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment