Updated - Automatic Mouse Mover
This commit is contained in:
@@ -63,122 +63,93 @@ cls
|
|||||||
echo Starting Mouse Mover...
|
echo Starting Mouse Mover...
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM Create PowerShell script file
|
REM Create PowerShell script
|
||||||
(
|
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
|
||||||
echo Add-Type -TypeDefinition @"
|
"Add-Type -TypeDefinition @' " ^
|
||||||
echo using System;
|
"using System; " ^
|
||||||
echo using System.Runtime.InteropServices;
|
"using System.Runtime.InteropServices; " ^
|
||||||
echo public class MouseMover {
|
"public class MouseMover { " ^
|
||||||
echo [DllImport("user32.dll"^)]
|
" [DllImport(\"user32.dll\")] " ^
|
||||||
echo public static extern bool GetCursorPos(out POINT lpPoint^);
|
" public static extern bool GetCursorPos(out POINT lpPoint); " ^
|
||||||
echo [DllImport("user32.dll"^)]
|
" [DllImport(\"user32.dll\")] " ^
|
||||||
echo public static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize^);
|
" public static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize); " ^
|
||||||
echo [StructLayout(LayoutKind.Sequential^)]
|
" [StructLayout(LayoutKind.Sequential)] " ^
|
||||||
echo public struct INPUT {
|
" public struct INPUT { " ^
|
||||||
echo public uint type;
|
" public uint type; " ^
|
||||||
echo public MOUSEINPUT mi;
|
" public MOUSEINPUT mi; " ^
|
||||||
echo }
|
" } " ^
|
||||||
echo [StructLayout(LayoutKind.Sequential^)]
|
" [StructLayout(LayoutKind.Sequential)] " ^
|
||||||
echo public struct MOUSEINPUT {
|
" public struct MOUSEINPUT { " ^
|
||||||
echo public int dx;
|
" public int dx; " ^
|
||||||
echo public int dy;
|
" public int dy; " ^
|
||||||
echo public uint mouseData;
|
" public uint mouseData; " ^
|
||||||
echo public uint dwFlags;
|
" public uint dwFlags; " ^
|
||||||
echo public uint time;
|
" public uint time; " ^
|
||||||
echo public IntPtr dwExtraInfo;
|
" public IntPtr dwExtraInfo; " ^
|
||||||
echo }
|
" } " ^
|
||||||
echo public struct POINT {
|
" public struct POINT { " ^
|
||||||
echo public int X;
|
" public int X; " ^
|
||||||
echo public int Y;
|
" public int Y; " ^
|
||||||
echo }
|
" } " ^
|
||||||
echo public const uint INPUT_MOUSE = 0;
|
" public const uint INPUT_MOUSE = 0; " ^
|
||||||
echo public const uint MOUSEEVENTF_MOVE = 0x0001;
|
" public const uint MOUSEEVENTF_MOVE = 0x0001; " ^
|
||||||
echo }
|
"} " ^
|
||||||
echo "@
|
"'@; " ^
|
||||||
echo.
|
"$interval = %INTERVAL%; " ^
|
||||||
echo $interval = %INTERVAL%
|
"$durationMinutes = %DURATION_MINUTES%; " ^
|
||||||
echo $durationMinutes = %DURATION_MINUTES%
|
"$random = New-Object System.Random; " ^
|
||||||
echo $random = New-Object System.Random
|
"$startTime = Get-Date; " ^
|
||||||
echo $startTime = Get-Date
|
"$moveCount = 0; " ^
|
||||||
echo $moveCount = 0
|
"Write-Host ''; " ^
|
||||||
echo.
|
"Write-Host '========================================' -ForegroundColor Green; " ^
|
||||||
echo Write-Host ""
|
"Write-Host 'Mouse Mover Active (Hardware Simulation)' -ForegroundColor Green; " ^
|
||||||
echo Write-Host "========================================" -ForegroundColor Green
|
"Write-Host '========================================' -ForegroundColor Green; " ^
|
||||||
echo Write-Host "Mouse Mover Active (Hardware Simulation)" -ForegroundColor Green
|
"Write-Host ''; " ^
|
||||||
echo Write-Host "========================================" -ForegroundColor Green
|
"Write-Host 'Monitoring mouse movement...'; " ^
|
||||||
echo Write-Host ""
|
"Write-Host 'Press Ctrl+C to stop'; " ^
|
||||||
echo Write-Host "Monitoring mouse movement..."
|
"Write-Host ''; " ^
|
||||||
echo Write-Host "Press Ctrl+C to stop"
|
"$lastPos = New-Object MouseMover+POINT; " ^
|
||||||
echo Write-Host ""
|
"[void][MouseMover]::GetCursorPos([ref]$lastPos); " ^
|
||||||
echo.
|
"while ($true) { " ^
|
||||||
echo $lastPos = New-Object MouseMover+POINT
|
" if ($durationMinutes -gt 0) { " ^
|
||||||
echo [void][MouseMover]::GetCursorPos([ref]$lastPos^)
|
" $elapsed = ((Get-Date) - $startTime).TotalMinutes; " ^
|
||||||
echo.
|
" if ($elapsed -ge $durationMinutes) { " ^
|
||||||
echo while ($true^) {
|
" Write-Host ''; " ^
|
||||||
echo if ($durationMinutes -gt 0^) {
|
" Write-Host 'Duration reached. Stopping...' -ForegroundColor Yellow; " ^
|
||||||
echo $elapsed = ((Get-Date^) - $startTime^).TotalMinutes
|
" break; " ^
|
||||||
echo if ($elapsed -ge $durationMinutes^) {
|
" } " ^
|
||||||
echo Write-Host ""
|
" } " ^
|
||||||
echo Write-Host "Duration reached. Stopping..." -ForegroundColor Yellow
|
" $currentPos = New-Object MouseMover+POINT; " ^
|
||||||
echo break
|
" [void][MouseMover]::GetCursorPos([ref]$currentPos); " ^
|
||||||
echo }
|
" if ($currentPos.X -ne $lastPos.X -or $currentPos.Y -ne $lastPos.Y) { " ^
|
||||||
echo }
|
" $lastPos = $currentPos; " ^
|
||||||
echo.
|
" $time = Get-Date -Format 'HH:mm:ss'; " ^
|
||||||
echo $currentPos = New-Object MouseMover+POINT
|
" Write-Host \"[$time] User moved mouse - Paused\" -ForegroundColor Cyan; " ^
|
||||||
echo [void][MouseMover]::GetCursorPos([ref]$currentPos^)
|
" Start-Sleep -Seconds $interval; " ^
|
||||||
echo.
|
" continue; " ^
|
||||||
echo if ($currentPos.X -ne $lastPos.X -or $currentPos.Y -ne $lastPos.Y^) {
|
" } " ^
|
||||||
echo $lastPos = $currentPos
|
" $moveX = $random.Next(-5, 6); " ^
|
||||||
echo $time = Get-Date -Format 'HH:mm:ss'
|
" $moveY = $random.Next(-5, 6); " ^
|
||||||
echo Write-Host "[$time] User moved mouse - Paused" -ForegroundColor Cyan
|
" $input = New-Object MouseMover+INPUT; " ^
|
||||||
echo Start-Sleep -Seconds $interval
|
" $input.type = [MouseMover]::INPUT_MOUSE; " ^
|
||||||
echo continue
|
" $input.mi.dx = $moveX; " ^
|
||||||
echo }
|
" $input.mi.dy = $moveY; " ^
|
||||||
echo.
|
" $input.mi.dwFlags = [MouseMover]::MOUSEEVENTF_MOVE; " ^
|
||||||
echo $moveX = $random.Next(-5, 6^)
|
" $input.mi.time = 0; " ^
|
||||||
echo $moveY = $random.Next(-5, 6^)
|
" $input.mi.dwExtraInfo = [IntPtr]::Zero; " ^
|
||||||
echo.
|
" $inputs = @($input); " ^
|
||||||
echo $input = New-Object MouseMover+INPUT
|
" [void][MouseMover]::SendInput(1, $inputs, [System.Runtime.InteropServices.Marshal]::SizeOf($input)); " ^
|
||||||
echo $input.type = [MouseMover]::INPUT_MOUSE
|
" $moveCount++; " ^
|
||||||
echo $input.mi.dx = $moveX
|
" $time = Get-Date -Format 'HH:mm:ss'; " ^
|
||||||
echo $input.mi.dy = $moveY
|
" Write-Host \"[$time] Auto-moved mouse ($moveCount moves)\" -ForegroundColor Green; " ^
|
||||||
echo $input.mi.dwFlags = [MouseMover]::MOUSEEVENTF_MOVE
|
" [void][MouseMover]::GetCursorPos([ref]$lastPos); " ^
|
||||||
echo $input.mi.time = 0
|
" Start-Sleep -Seconds $interval; " ^
|
||||||
echo $input.mi.dwExtraInfo = [IntPtr]::Zero
|
"} " ^
|
||||||
echo.
|
"Write-Host ''; " ^
|
||||||
echo $inputs = @($input^)
|
"Write-Host '========================================' -ForegroundColor Yellow; " ^
|
||||||
echo [void][MouseMover]::SendInput(1, $inputs, [System.Runtime.InteropServices.Marshal]::SizeOf($input^)^)
|
"Write-Host 'Mouse Mover Stopped' -ForegroundColor Yellow; " ^
|
||||||
echo $moveCount++
|
"Write-Host \"Total moves: $moveCount\" -ForegroundColor Yellow; " ^
|
||||||
echo.
|
"Write-Host '========================================' -ForegroundColor Yellow;"
|
||||||
echo $time = Get-Date -Format 'HH:mm:ss'
|
|
||||||
echo Write-Host "[$time] Auto-moved mouse ($moveCount moves)" -ForegroundColor Green
|
|
||||||
echo.
|
|
||||||
echo [void][MouseMover]::GetCursorPos([ref]$lastPos^)
|
|
||||||
echo.
|
|
||||||
echo Start-Sleep -Seconds $interval
|
|
||||||
echo }
|
|
||||||
echo.
|
|
||||||
echo Write-Host ""
|
|
||||||
echo Write-Host "========================================" -ForegroundColor Yellow
|
|
||||||
echo Write-Host "Mouse Mover Stopped" -ForegroundColor Yellow
|
|
||||||
echo Write-Host "Total moves: $moveCount" -ForegroundColor Yellow
|
|
||||||
echo Write-Host "========================================" -ForegroundColor Yellow
|
|
||||||
echo.
|
|
||||||
echo Start-Sleep -Seconds $interval
|
|
||||||
echo }
|
|
||||||
echo.
|
|
||||||
echo Write-Host ""
|
|
||||||
echo Write-Host "========================================" -ForegroundColor Yellow
|
|
||||||
echo Write-Host "Mouse Mover Stopped" -ForegroundColor Yellow
|
|
||||||
echo Write-Host "Total moves: $moveCount" -ForegroundColor Yellow
|
|
||||||
echo Write-Host "========================================" -ForegroundColor Yellow
|
|
||||||
) > "%TEMP%\MouseMover.ps1"
|
|
||||||
|
|
||||||
REM Execute PowerShell script
|
|
||||||
powershell -ExecutionPolicy Bypass -File "%TEMP%\MouseMover.ps1"
|
|
||||||
|
|
||||||
REM Cleanup
|
|
||||||
del "%TEMP%\MouseMover.ps1" >nul 2>&1
|
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ========================================
|
echo ========================================
|
||||||
|
|||||||
Reference in New Issue
Block a user