[system.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null
Add-Type -MemberDefinition '[DllImport("user32.dll")] public static extern void mouse_event(int flags, int dx, int dy, int cButtons, int info);' -Name U32 -Namespace W;
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(1900,700);
for (($i = 0); $i -lt 9000; $i++) {
for (($j = 0); $j -lt 500; $j++) {
[W.U32]::mouse_event(6,0,0,0,0);
[W.U32]::mouse_event(24,0,0,0,0);
echo $j
Start-Sleep -m 10;
}
Start-Sleep -s 10;
}
Mouse is moved to a certain position ( [1900, 700] here) before clicking. This script consists of both left click (left down + left up) and right click (right down + right up). Remove any if not needed. There is a 10s pause after 500 clicks so that users can terminate the script during this time. The echo and sleep in inner loop slow down the script. Looks like some games cannot handle 500 clicks all at once.
Back