Created
May 22, 2022 22:14
-
-
Save Icaruk/9f6774a2ec0d2feedd9e0fff8e0bb6fe to your computer and use it in GitHub Desktop.
Prints mouse coordinates every X seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Interval = Read-Host -Prompt 'Write time interval in seconds. Default is 1 second' | |
if ($Interval -le 0) { | |
$Interval = 1 | |
} | |
if ($Interval -lt 0.25) { | |
$Interval = 0.25 | |
} | |
Write-Host -ForegroundColor Yellow "Interval = $Interval seconds" | |
Write-Host "Press ctrl + C to stop" | |
Write-Host -ForegroundColor Green "Starting..." | |
start-sleep -seconds 2 | |
while (1 -eq 1 ){ | |
Add-Type -AssemblyName System.Windows.Forms | |
$X = [System.Windows.Forms.Cursor]::Position.X | |
$Y = [System.Windows.Forms.Cursor]::Position.Y | |
Write-Output "X: $X | Y: $Y" | |
start-sleep -seconds $Interval | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment