Created
February 25, 2021 15:46
-
-
Save neo7BF/deda3afb61bcc033ce0893fbc3335b55 to your computer and use it in GitHub Desktop.
Devices input management from powershell
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
#################### | |
# KEYBOARD VERSION # | |
#################### | |
$shell = New-Object -ComObject WScript.Shell | |
while(1) { | |
$shell.sendkeys("{NUMLOCK}{NUMLOCK}") | |
$time = Get-Date; | |
$shorterTimeString = $time.ToString("HH:mm:ss"); | |
Write-Host $shorterTimeString "NUMLOCK pressed twice" | |
#Set your duration between each mouse move | |
Start-Sleep -Seconds 10 | |
} | |
################# | |
# MOUSE VERSION # | |
################# | |
#Add-Type -AssemblyName System.Windows.Forms | |
#$position = [System.Windows.Forms.Cursor]::Position | |
#$position.X++ | |
#[System.Windows.Forms.Cursor]::Position = $position | |
#while(1) { | |
# $position = [System.Windows.Forms.Cursor]::Position | |
# $position.X++ | |
# [System.Windows.Forms.Cursor]::Position = $position | |
# $time = Get-Date; | |
# $shorterTimeString = $time.ToString("HH:mm:ss"); | |
# Write-Host $shorterTimeString "Mouse pointer has been moved 1 pixel to the right" | |
#Set your duration between each mouse move | |
# Start-Sleep -Seconds 10 | |
#} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment