for Russian-speaking users Документация на русском
This Python script is an auto-clicker that prevents multiple instances from running simultaneously by creating a lock file on the desktop. When launched, the script checks for an existing lock file. If found, it terminates the previous instance of the script, moves the lock file to the recycle bin, and then creates a new lock file for the current instance.
- Lock File Control: Prevents multiple instances by creating a lock file on your desktop.
- Auto Clicker: Auto-clicks using the left mouse button when the side button (Mouse4, or X1 button) is pressed.
- Process Cleanup: Moves the previous instance’s lock file to the recycle bin and terminates the previous process if running.
- Visual Feedback: Displays an "ON" or "OFF" window for a brief period to indicate the current state.
- Python 3.x: Make sure Python is installed. You can download it from python.org.
- Required libraries: These can be installed via
pip
. (Instructions below)
-
Download the Script:
- Go to the GitHub repository where this script is hosted.
- Click on the green "Code" button.
- Choose "Download ZIP" and save the ZIP file to your computer.
- Extract the ZIP file to a folder of your choice.
-
Install Dependencies:
-
Open the extracted folder.
-
Hold the
Shift
key and right-click inside the folder, then select "Open PowerShell window here" (or "Open Command Prompt here" depending on your system). -
Type the following command to install the necessary Python libraries:
pip install -r requirements.txt
If you encounter any issues with
pip
, make sure Python andpip
are correctly installed and added to your system's PATH. -
-
Modify the Lock File Path: Open the script file (usually a
.py
file) in a text editor (like Notepad). Replacepath_to_your_desktop
with the path to your actual desktop. This lock file ensures only one instance runs at a time.lock_file = "path_to_your_desktop\\program_lock.lock"
-
Change the Activation Button: By default, the script is set to activate with the side mouse button
Mouse4
(also known asX1 button
). If you want to change the button, open the script file and find this line in theon_click
function:if button == Button.x1:
Replace
Button.x1
with any of the following options:Button.left
for the left mouse buttonButton.right
for the right mouse buttonButton.middle
for the middle mouse buttonButton.x1
for theMouse4
(X1 button)Button.x2
for theMouse5
(X2 button)
Example of using the mouse4 as an activation button:
if button == Button.x1:
-
Run the Script:
- Double-click the Python script file (usually with a
.py
extension) to start the auto-clicker.
- Double-click the Python script file (usually with a
-
How to Use the Auto-Clicker:
- Press the side mouse button (Mouse4 or X1 button) to start auto-clicking.
- Release the button to stop auto-clicking.
-
Visual Indicators:
- The "ON" window will briefly display when the script starts.
- The "OFF" window will display if the script finds an existing instance and terminates it.
- Lock File Control: The lock file (
program_lock.lock
) is created and deleted automatically. If you manually delete it, ensure no other instance of the script is running. - Termination: When a new instance starts, it terminates the previous instance to ensure only one is active.
If you set lock_file
as "C:\\Users\\YourUsername\\Desktop\\program_lock.lock"
, the script will use this path to control the instance locking.
This project is licensed under the MIT License.