Created
December 17, 2024 16:06
-
-
Save tomesparon/6e6a2f0c2f98409aeeefc2aa0aa9729c to your computer and use it in GitHub Desktop.
Auto clicker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add necessary types for mouse events | |
Add-Type @" | |
using System; | |
using System.Runtime.InteropServices; | |
public class Mouse { | |
[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); | |
public const int MOUSEEVENTF_LEFTDOWN = 0x02; | |
public const int MOUSEEVENTF_LEFTUP = 0x04; | |
} | |
"@ | |
# Function to perform a mouse click | |
function Click-Mouse { | |
[Mouse]::mouse_event([Mouse]::MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) | |
[Mouse]::mouse_event([Mouse]::MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) | |
} | |
# Number of clicks | |
$clicks = 60 | |
# Wait for 3 seconds | |
Start-Sleep -Seconds 3 | |
# Perform the clicks | |
for ($i = 0; $i -lt $clicks; $i++) { | |
Click-Mouse | |
Start-Sleep -Milliseconds 500 # Adjust the delay between clicks if needed | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment