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