Updated - Automatic Mouse Mover
This commit is contained in:
@@ -70,13 +70,34 @@ echo using System;
|
|||||||
echo using System.Runtime.InteropServices;
|
echo using System.Runtime.InteropServices;
|
||||||
echo public class MouseMover {
|
echo public class MouseMover {
|
||||||
echo [DllImport("user32.dll"^)]
|
echo [DllImport("user32.dll"^)]
|
||||||
echo public static extern bool SetCursorPos(int X, int Y^);
|
|
||||||
echo [DllImport("user32.dll"^)]
|
|
||||||
echo public static extern bool GetCursorPos(out POINT lpPoint^);
|
echo public static extern bool GetCursorPos(out POINT lpPoint^);
|
||||||
|
echo
|
||||||
|
echo [DllImport("user32.dll"^)]
|
||||||
|
echo public static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize^);
|
||||||
|
echo
|
||||||
|
echo [StructLayout(LayoutKind.Sequential^)]
|
||||||
|
echo public struct INPUT {
|
||||||
|
echo public uint type;
|
||||||
|
echo public MOUSEINPUT mi;
|
||||||
|
echo }
|
||||||
|
echo
|
||||||
|
echo [StructLayout(LayoutKind.Sequential^)]
|
||||||
|
echo public struct MOUSEINPUT {
|
||||||
|
echo public int dx;
|
||||||
|
echo public int dy;
|
||||||
|
echo public uint mouseData;
|
||||||
|
echo public uint dwFlags;
|
||||||
|
echo public uint time;
|
||||||
|
echo public IntPtr dwExtraInfo;
|
||||||
|
echo }
|
||||||
|
echo
|
||||||
echo public struct POINT {
|
echo public struct POINT {
|
||||||
echo public int X;
|
echo public int X;
|
||||||
echo public int Y;
|
echo public int Y;
|
||||||
echo }
|
echo }
|
||||||
|
echo
|
||||||
|
echo public const uint INPUT_MOUSE = 0;
|
||||||
|
echo public const uint MOUSEEVENTF_MOVE = 0x0001;
|
||||||
echo }
|
echo }
|
||||||
echo "@
|
echo "@
|
||||||
echo.
|
echo.
|
||||||
@@ -88,7 +109,7 @@ echo $moveCount = 0
|
|||||||
echo.
|
echo.
|
||||||
echo Write-Host ""
|
echo Write-Host ""
|
||||||
echo Write-Host "========================================" -ForegroundColor Green
|
echo Write-Host "========================================" -ForegroundColor Green
|
||||||
echo Write-Host "Mouse Mover Active" -ForegroundColor Green
|
echo Write-Host "Mouse Mover Active (Hardware Simulation^)" -ForegroundColor Green
|
||||||
echo Write-Host "========================================" -ForegroundColor Green
|
echo Write-Host "========================================" -ForegroundColor Green
|
||||||
echo Write-Host ""
|
echo Write-Host ""
|
||||||
echo Write-Host "Monitoring mouse movement..."
|
echo Write-Host "Monitoring mouse movement..."
|
||||||
@@ -121,14 +142,21 @@ echo }
|
|||||||
echo.
|
echo.
|
||||||
echo $moveX = $random.Next(-5, 6^)
|
echo $moveX = $random.Next(-5, 6^)
|
||||||
echo $moveY = $random.Next(-5, 6^)
|
echo $moveY = $random.Next(-5, 6^)
|
||||||
echo $newX = $currentPos.X + $moveX
|
|
||||||
echo $newY = $currentPos.Y + $moveY
|
|
||||||
echo.
|
echo.
|
||||||
echo [void][MouseMover]::SetCursorPos($newX, $newY^)
|
echo $input = New-Object MouseMover+INPUT
|
||||||
|
echo $input.type = [MouseMover]::INPUT_MOUSE
|
||||||
|
echo $input.mi.dx = $moveX
|
||||||
|
echo $input.mi.dy = $moveY
|
||||||
|
echo $input.mi.dwFlags = [MouseMover]::MOUSEEVENTF_MOVE
|
||||||
|
echo $input.mi.time = 0
|
||||||
|
echo $input.mi.dwExtraInfo = [IntPtr]::Zero
|
||||||
|
echo.
|
||||||
|
echo $inputs = @($input^)
|
||||||
|
echo [void][MouseMover]::SendInput(1, $inputs, [System.Runtime.InteropServices.Marshal]::SizeOf($input^)^)
|
||||||
echo $moveCount++
|
echo $moveCount++
|
||||||
echo.
|
echo.
|
||||||
echo $time = Get-Date -Format 'HH:mm:ss'
|
echo $time = Get-Date -Format 'HH:mm:ss'
|
||||||
echo Write-Host "[$time] Auto-moved mouse ($moveCount moves)" -ForegroundColor Green
|
echo Write-Host "[$time] Auto-moved mouse ($moveCount moves^)" -ForegroundColor Green
|
||||||
echo.
|
echo.
|
||||||
echo [void][MouseMover]::GetCursorPos([ref]$lastPos^)
|
echo [void][MouseMover]::GetCursorPos([ref]$lastPos^)
|
||||||
echo.
|
echo.
|
||||||
|
|||||||
Reference in New Issue
Block a user