Skip to content

Instantly share code, notes, and snippets.

@NullClock
Last active December 13, 2023 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NullClock/77b7c28b083076e773623a0e88312bc9 to your computer and use it in GitHub Desktop.
Save NullClock/77b7c28b083076e773623a0e88312bc9 to your computer and use it in GitHub Desktop.
AutoclickJS

AutoclickJS


The JS autoclicker.

alert("Hold CTRL while pressing the spot to autoclick.");
document.body.addEventListener("click", (e) => {
   if (e.ctrlKey) {
       alert("Autoclicking! Press ALT + C to stop.");
       const tx = e.clientX;
       const ty = e.clientY;
       let iy = false;

       const real = document.elementFromPoint(tx, ty);

       setInterval(()=>{
           if (iy == false) { real.click() }
       }, 1);

       document.body.addEventListener("keydown", (e) => {
           if (e.altKey && e.key.toLowerCase() == "c") {
               iy = true;
           }
       });
   }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment