# Autoclicker help

**URL:** <https://discuss.python.org/t/autoclicker-help/69989>\
**Category:** Python Help\
**Tags:** help\
**Created:** [November 2, 2024, 9:08pm UTC](https://discuss.python.org/t/autoclicker-help/69989 "2024-11-02T21:08:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaesk](https://avatars.discourse-cdn.com/v4/letter/k/e79b87/32.png) [@kaesk](https://discuss.python.org/u/kaesk)\
**Post date:** [November 2, 2024, 9:08pm UTC](https://discuss.python.org/t/autoclicker-help/69989/1 "2024-11-02T21:08:00Z")

</div>

How is it possible to make a fast hold LMB to autoclick LMB autoclicker in python

Main issue is cant differenciate simulated clicks from mouse clicks so the autoclicker cancels itself

i have already tried:  
making “simulated clicking” variable while its doing a simulated clicks  
This works pretty well but at high speeds its unreliable and breaks sometimes, cancelling the autoclicker  
I have also tried making it wait until a simulated click is fully processed before setting the variable to false, also works pretty well but sometimes if i stop holding LMB while its on well it also breaks and doesnt cancel when i unhold LMB

So how is it possible to make that kind of hold to click autoclicker in python ? any libraries recommand? thanks for help

---

<div class="post-metadata">

**Author:** ![ssweber](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ssweber/32/9684_2.png) [@ssweber](https://discuss.python.org/u/ssweber)\
**Post date:** [November 2, 2024, 9:09pm UTC](https://discuss.python.org/t/autoclicker-help/69989/2 "2024-11-02T21:09:22Z")

</div>

If on Windows take a look at [GitHub - CodeOptimist/ahkunwrapped: Bundled and bridged AutoHotkey for full native code execution from Python.](https://github.com/CodeOptimist/ahkunwrapped)

---

<div class="post-metadata">

**Author:** ![AlSweigart](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/alsweigart/32/12237_2.png) [@AlSweigart](https://discuss.python.org/u/AlSweigart)\
**Post date:** [November 2, 2024, 10:48pm UTC](https://discuss.python.org/t/autoclicker-help/69989/3 "2024-11-02T22:48:16Z")

</div>

You can use PyAutoGUI. Install it by running `pip install pyautogui`

Then call the `pyautogui.click()` function. For safety reasons, you can slam the mouse cursor to one of the four corners of the screen to stop the script. There is also a 0.1 second pause after all PyAutoGUI function calls. To disable this (not recommended) and have it click as fast as possible, you can run `pyautogui.PAUSE = 0`.
