Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #########################################################################
- $StartupDelay = 3000 # Time to wait before starting in milliseconds
- $TimeBetweenClicks = 5000 # Time to wait between clicks in milliseconds
- #########################################################################
- Add-Type -AssemblyName System.Windows.Forms
- Add-Type -AssemblyName System.Drawing
- $signature=@'
- [DllImport("user32.dll",CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)]
- public static extern void mouse_event(long dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
- '@
- $SendMouseClick = Add-Type -memberDefinition $signature -name "Win32MouseEventNew" -namespace Win32Functions -passThru
- Start-Sleep -Milliseconds $StartupDelay
- while (1) {
- $x = [System.Windows.Forms.Cursor]::Position.X
- $y = [System.Windows.Forms.Cursor]::Position.Y
- # Uncomment below lines to manually specify click location
- # $x = 100
- # $y = 100
- # [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
- $SendMouseClick::mouse_event(0x00000002, 0, 0, 0, 0); # Left click down
- $SendMouseClick::mouse_event(0x00000004, 0, 0, 0, 0); # Left click up
- Write-Output "X: $x | Y: $y"
- Start-Sleep -Milliseconds $TimeBetweenClicks
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement