Mac OS users : Make sure to have accessiblity and input monitoring, allowed in privacy. Note: id allow it for not just the IDE your using, but also the Python download and the idle, and if that doesnt work , perhaps the terminal aswell.
@seran35142 жыл бұрын
This is the full code: import time import threading from pynput.mouse import Button, Controller from pynput.keyboard import Listener, KeyCode TOGGLE_KEY = KeyCode(char="s") clicking = False mouse = Controller() def clicker(): while True: if clicking: mouse.click(Button.left, 1) time.sleep(0.0001) def toggle_event(key): if key == TOGGLE_KEY: global clicking clicking = not clicking click_thread = threading.Thread(target=clicker) click_thread.start() with Listener(on_press=toggle_event) as listener: listener.join()
@ugvey6494 Жыл бұрын
thanks
@jimmypetrock Жыл бұрын
tysm
@donnydavenport4804 Жыл бұрын
what application do i use the code in? im new to this
@seran3514 Жыл бұрын
@@donnydavenport4804 i use vscode
@johnnyblessings602511 ай бұрын
@@donnydavenport4804 pycharm
@DonovanKong2 жыл бұрын
Thank you for sharing this! I modified this code so when I'm taking a 'break' from work, my work laptop doesn't auto lock itself 😂😂
@ranwinsu83512 жыл бұрын
You have to finish the work not how much hours you have worked
@techera35632 жыл бұрын
@@ranwinsu8351 it's totally depends on how much you get payed 😂
@ranwinsu83512 жыл бұрын
@@techera3563 In India it's always less only no need to worry🤣😃
@frostman32 жыл бұрын
Nice try jeffrey, see you in HR tomorrow
@christalball93_ Жыл бұрын
Your IT gonna find this probly
@cyborgsmurf64462 жыл бұрын
The thing you said about sleeping was so eye openeing for me. Thank you so much, this also makes so much sense. Love it bro! ♥
@DRVGON-12 жыл бұрын
here is the code if your lazy: def clicker(): while True: if clicking: mouse.click(Button. Left, 1) time.sleep(0.001) def toggle_event(key) if key == TOGGLE_KEY: global clicking clicking = not clicking click_thread = threading.Thread(target=clicker) click_thread.start() with Listener(on_press=toggle_event) as Listener: listener.join()
@KontrolStyle2 жыл бұрын
nice
@Dr.Computer3654 ай бұрын
let me make it bater using chatgpt but giveing it gui like if rinning it says running in bottom left corner of screen hear is code :) import time import threading from pynput.mouse import Controller, Button from pynput.keyboard import Listener, KeyCode import tkinter as tk TOGGLE_KEY = KeyCode(char="q") clicking = False mouse = Controller() def clicker(): while True: if clicking: mouse.click(Button.left, 1) time.sleep(5) def toggle_event(key): global clicking if key == TOGGLE_KEY: clicking = not clicking update_gui() def update_gui(): if clicking: status_label.config(text="Running", bg="#66CDAA") # Medium green else: status_label.config(text="Off", bg="#FA8072") # Medium red def start_clicker_thread(): click_thread = threading.Thread(target=clicker, daemon=True) click_thread.start() def start_listener(): with Listener(on_press=toggle_event) as listener: listener.join() # Create the GUI in the main thread root = tk.Tk() root.title("Clicker Status") # Position the window at the bottom right corner and make it smaller screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() window_width = 60 window_height = 30 root.geometry(f"{window_width}x{window_height}+{screen_width - window_width}+{screen_height - window_height}") # Use slightly darker colors for the background status_label = tk.Label(root, text="Off", bg="#FA8072", fg="white", font=("Arial", 10)) # Medium red status_label.pack(fill="both", expand=True) # Remove the window border to make it less obtrusive root.overrideredirect(True) # Keep the window always on top root.attributes("-topmost", True) # Start the clicking and listener in separate threads start_clicker_thread() threading.Thread(target=start_listener, daemon=True).start() # Start the tkinter main loop in the main thread root.mainloop()
@jasoncooke574110 ай бұрын
A couple struggles along the way. Had to learn how to add system variables for python and pip so that I could pip install pynput. For some reason was getting an error saying toggle_event not defined but code was right. After I restarted my Visual Studio Code program I was able to get it to run and it works perfect. I didn't want to download some auto clicker from the internet they were all getting virus hits from virus total and other scan tools so I was worried. This worked perfect. The only thing I think would make it better is to have another hot key to turn off the program so you can move to another site for a moment and not worry you will auto click something. Something like ctrl + t + e then the program pauses and allows you to type without it coming on. All in all it works great thank you so much.
@mywillbedonex11 ай бұрын
How do i add EXIT_KEY = KeyCode(char="e") to work as a exit button to terminate the program?
@DaRkStyLe69boombang2 жыл бұрын
Hello😄 ¿How could I establish some coordinates so that it clicks on those coordinates?🤔
@Feavv112 жыл бұрын
Great tutorial! I watch ur vids all the time they always help me with any problems I have with coding. :) and btw, What theme are you using? it looks nice.
@Megaheropap2 жыл бұрын
Is it possible to make it click when you have left click held down?
@mivano32362 жыл бұрын
Question: In 2:36, why did you go for “while true” and “if clicking” instead of “while clicking”
@NeuralNine2 жыл бұрын
Because the sleep at the bottom has to be executed even if clicking is False
@lalitmehra47517 ай бұрын
Can we do something that can automate series of clicks ?
@happyfishgaming68 Жыл бұрын
is it possible to set this to autoclick a key, for example press the space bar every second?
@Ricocase2 жыл бұрын
Is it possible to randomize sleep times within a small range so that backdoor software won't detect the program as too predictable?
@LordRyn2 жыл бұрын
Edit: Zlyphes comment has a better usage of random import random and then use random.randrange(1, 100) where 1 is the lowest and 100 is the highest spot. Then just put that in time.sleep(). for example: import time import random time.sleep(random.randrange(5, 25))
@LordRyn2 жыл бұрын
@Zlyphe Thanks, I learned something new today!
@quasii72 жыл бұрын
@@LordRyn randrange(1, 100) returns a random integer where 1
@kulkid_2 жыл бұрын
You can do that. You need to import random and generate a random number between 1 and 10. Every time it clicks the sleep would have this random number and devide it by 1000.
@HansiKlein2 жыл бұрын
Salve Ist it possible to click into an window at a specific position, while it is minimised (is that the right word?) And is it possible to perform this in the background and continue working normal with other applications? Like a running VM? Kind regards Hans
@Dr.Computer3654 ай бұрын
do you get answers?
@HansiKlein4 ай бұрын
@@Dr.Computer365 hmm no didn't get one. Do you have it ^^?
@Dr.Computer3654 ай бұрын
@@HansiKlein maybe chatgpt can! it says to use Linux
@FRESHWWW Жыл бұрын
Thanks alot bro, i needed to ask if there is a way to make a mouse auto clicker click following a directed or a specific sound ??
@acalSniper3 күн бұрын
At 2:52 does jt have to be 1 or it could be more?
@hexadzn2 күн бұрын
1 mean left mouse button 2 is right click 3 is middle mouse button
@acalSniper2 күн бұрын
@hexadzn oh ok thanks for the explanation
@nmhero48242 жыл бұрын
what does listener.join() do? I keep getting the error: TypeError: 'Listener' object is not callable
@seran35142 жыл бұрын
with Listener(on_press=on_press) as listener: listener.join() Look for Caps
@BruceVayne Жыл бұрын
I just copied the exact same code but is doing nothing when I press "t"
@Dr.Computer3654 ай бұрын
let me make it bater using chatgpt but giveing it gui like if rinning it says running in bottom left corner of screen hear is code :) import time import threading from pynput.mouse import Controller, Button from pynput.keyboard import Listener, KeyCode import tkinter as tk TOGGLE_KEY = KeyCode(char="q") clicking = False mouse = Controller() def clicker(): while True: if clicking: mouse.click(Button.left, 1) time.sleep(5) def toggle_event(key): global clicking if key == TOGGLE_KEY: clicking = not clicking update_gui() def update_gui(): if clicking: status_label.config(text="Running", bg="#66CDAA") # Medium green else: status_label.config(text="Off", bg="#FA8072") # Medium red def start_clicker_thread(): click_thread = threading.Thread(target=clicker, daemon=True) click_thread.start() def start_listener(): with Listener(on_press=toggle_event) as listener: listener.join() # Create the GUI in the main thread root = tk.Tk() root.title("Clicker Status") # Position the window at the bottom right corner and make it smaller screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() window_width = 60 window_height = 30 root.geometry(f"{window_width}x{window_height}+{screen_width - window_width}+{screen_height - window_height}") # Use slightly darker colors for the background status_label = tk.Label(root, text="Off", bg="#FA8072", fg="white", font=("Arial", 10)) # Medium red status_label.pack(fill="both", expand=True) # Remove the window border to make it less obtrusive root.overrideredirect(True) # Keep the window always on top root.attributes("-topmost", True) # Start the clicking and listener in separate threads start_clicker_thread() threading.Thread(target=start_listener, daemon=True).start() # Start the tkinter main loop in the main thread root.mainloop()
@wolfgaming2724 Жыл бұрын
how come it keeps saying failed to launch debug adapter additional information may be available in the output window? I really wanna get into coding but idk why this is happening.
@kekyes715 Жыл бұрын
is it possible to click on a location without the cursor being affected so you can use the cursor freely in the meanwhile?
@chxrry_blossomz10 ай бұрын
no
@lowelectronics Жыл бұрын
import time import threading from pynput.mouse import Controller, Button from pynput.keyboard import Listener, KeyCode TOGGLE_KEY = KeyCode(char='t') clicking = False mouse = Controller() def clicker(): while True: if clicking: mouse.click(Button.left, 1) time.sleep(0.0001) def toggle_event(key): global clicking if key == TOGGLE_KEY: clicking = not clicking click_thread = threading.Thread(target=clicker) click_thread.start() with Listener(on_release=toggle_event) as listener: listener.join()
@jadhereggs9953 Жыл бұрын
Thanks
@TomasSab3D2 жыл бұрын
can run a loop, where click is done as long as the "t" key is down... but threading is cooler.
@RSTOwner Жыл бұрын
it says this when i try to save it: Traceback (most recent call last): File "C:/Users/lenovo/Desktop/auto lol.py", line 6, in TOGGLE_KEY - KeyCode(char="c") NameError: name 'TOGGLE_KEY' is not defined
@martin_taavet Жыл бұрын
Youliterally used minus instead of equal sign💀
@TecnologiaAnimada Жыл бұрын
primeira vez que um tutorial de python deu certo pra mim! obrigado, thx, like like like
@GrayM22 жыл бұрын
Hey man it’s telling me that”This process is not trusted! Input event monitoring will not be possible until it is added to accessibility clients.”I use a Mac and visual studio code. Got any idea on how I could make it work?
@gabbygabby79152 жыл бұрын
Mac OS users : Make sure to have accessiblity and input monitoring, allowed in privacy. Note: id allow it for not just the IDE your using, but also the Python download and the idle, and if that doesnt work, perhaps the terminal aswell.
@manoranjanbasak542910 ай бұрын
Thanx! would you please bulid a Python Bot with following features: #Click once #A specific button on screen, which is previously introduced to the Bot, & the button is *changeable #Just at a point of presetted time, up to the lowest possible fraction or precision of time supported by the system, which is *modifiable #*Changeable, *modifiable -using GUI.
@FNJoJoSiwa2 жыл бұрын
anyone know how to fix this it's my only errors Import "pynput.mouse" could not be resolved from source (PylancereportMissingModuleSource) and Import "pynput.keyboard" could not be resolved from source (PylancereportMissingModuleSource) thanks it will help me a lot
@РенатаРитм Жыл бұрын
I have the same problem however I installed pynput. Help us please!
@mista_ia11 ай бұрын
Nice, however looks like the click does not work for windows dialog box 😢
@happyfishgaming68 Жыл бұрын
what if i want the toggle to be a key like f12, do i just type f12 or do i need to do something else?
@Vamka Жыл бұрын
did you find out?
@ThisIsAUsername69Ай бұрын
Bit late with the answer, but here goes for anyone else wondering: Add Key at the end of import line like this "from pynput.keyboard import Listener, KeyCode, Key" And change TOGGLE_KEY line to "TOGGLE_KEY = Key.f5" or whatever.
@Phoenix5uper13 күн бұрын
@@ThisIsAUsername69 thanks bro, but wanna ask for how can make pick the location cursor ?, i means if we press keyboard then the cursor location as we was set it
@mmmmm-k1m Жыл бұрын
hey man. i need code that automatically goes to on a website and clicking on a button.can you educate it?
@23matija6 ай бұрын
Can anyone help with number of clicks per second. I wanted to set to be one click per second, but when I change time.sleep to 1, or 100 , it doesn't change anything. How to make clicking slower? Thx in advance
@billigerfusel2 жыл бұрын
Interesting topic. As a C dev I have to take a look at how pynput does it below the hood.
@blitz-nk8fw8 ай бұрын
Here is the full code if anyone needs it : import time import threading from pynput.mouse import Controller, Button from pynput.keyboard import Listener, KeyCode TOGGLE_KEY = KeyCode(char="t") clicking = False mouse = Controller() def clicker(): while True: if clicking: mouse.click(Button.left, 1) time.sleep(0.0001) def toggle_event(key): if key == TOGGLE_KEY: global clicking clicking = not clicking click_thread = threading.Thread(target=clicker) click_thread.start() with Listener(on_press=toggle_event) as Listener: Listener.join()
@Dr.Computer3654 ай бұрын
let me make it bater using chatgpt but giveing it gui like if rinning it says running in bottom left corner of screen hear is code :) import time import threading from pynput.mouse import Controller, Button from pynput.keyboard import Listener, KeyCode import tkinter as tk TOGGLE_KEY = KeyCode(char="q") clicking = False mouse = Controller() def clicker(): while True: if clicking: mouse.click(Button.left, 1) time.sleep(5) def toggle_event(key): global clicking if key == TOGGLE_KEY: clicking = not clicking update_gui() def update_gui(): if clicking: status_label.config(text="Running", bg="#66CDAA") # Medium green else: status_label.config(text="Off", bg="#FA8072") # Medium red def start_clicker_thread(): click_thread = threading.Thread(target=clicker, daemon=True) click_thread.start() def start_listener(): with Listener(on_press=toggle_event) as listener: listener.join() # Create the GUI in the main thread root = tk.Tk() root.title("Clicker Status") # Position the window at the bottom right corner and make it smaller screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() window_width = 60 window_height = 30 root.geometry(f"{window_width}x{window_height}+{screen_width - window_width}+{screen_height - window_height}") # Use slightly darker colors for the background status_label = tk.Label(root, text="Off", bg="#FA8072", fg="white", font=("Arial", 10)) # Medium red status_label.pack(fill="both", expand=True) # Remove the window border to make it less obtrusive root.overrideredirect(True) # Keep the window always on top root.attributes("-topmost", True) # Start the clicking and listener in separate threads start_clicker_thread() threading.Thread(target=start_listener, daemon=True).start() # Start the tkinter main loop in the main thread root.mainloop()
@coopcoop82 жыл бұрын
Good luck catching me now Jagex!
@naganarasimhasaigurajala58882 жыл бұрын
Sir how to remove that key event I have tried to unistall pynput but it is not going
@danielzhydkov61712 жыл бұрын
Did you manage to delete it?
@philtoa3342 жыл бұрын
Kool can you make one more advanced with color , text or picture recognation ? Thx.
@shocco08162 жыл бұрын
hey what program do you use to code in python?
@deleted_channel-y2e2 жыл бұрын
VS Code is better than his and it's free!
@SidTheGreat4202 жыл бұрын
Pycharm
@deleted_channel-y2e2 жыл бұрын
@@SidTheGreat420 mid
@shocco08162 жыл бұрын
@@deleted_channel-y2e fax not gonna lie
@graydonpivec67287 ай бұрын
what version of python are you using? specifically what are you actually writing the code in?
@bloober2166 ай бұрын
i think thats pycharm(jetbrains)
@fernandopeaz1009 Жыл бұрын
What about for a certain amount of clicks
@UnknownContentCreator_Real9 ай бұрын
bro you crashed my laptop. the first time it doesnt work. when i restarted my laptop it freezed
@jamesonmollis32102 жыл бұрын
please what type of python do you have? mine doe not display like yours
@mcnastysavageyt6569 ай бұрын
He's using an IDE, which are just basically compilers. Not sure which one he is using though. Pyhton does offer a list of trusted IDE's on their website you can look at. They all pretty much function the same.
@S_yIvie2 ай бұрын
the pynput download doesnt work for me
@RSTOwner Жыл бұрын
it doesnt work anymore it was working earlier what happened?
@IamGbono3 ай бұрын
Hi, please, how can I use this to click on apps on android?
@cagataydemirbas72592 жыл бұрын
Can you make bots for online games with Python?
@agent61242 жыл бұрын
yes
@santoshkumargouda60332 жыл бұрын
Please make a video on data engineering
@ProfGira2 жыл бұрын
Hey, I am a noob at programming, and python will run the script, but it just doesn't work. Not sure what I am doing wrong, but the code is the same, the program is running, but I am hitting T and nothing is happening.
@piotrmakowski19612 жыл бұрын
Same for me.
@KontrolStyle2 жыл бұрын
make sure you have the threading pip installed, if this isn't it.. at least i tired.
@rasseto4835 Жыл бұрын
What programe are you using when u coding pls help i am so much beginner :( !!!
@sane-gb7ji Жыл бұрын
VS code
@tcgvsocg14582 жыл бұрын
Thx for all your great video can you show how to inject script like change stat in elden ring / nioh game this will be really interesting
@nadavoshka21642 жыл бұрын
ModuleNotFoundError: No module named 'pynput' and i did the cmd part
@kaosdavy87022 жыл бұрын
same for me, did you ever figure it out
@teorailin2 жыл бұрын
pip install pynput
@braydenmccauley1522 Жыл бұрын
It does not work with VScode and I’m not sure why
@clearshot63532 жыл бұрын
Thanks, I just got 99 magic via alching!
@suertesamp2 жыл бұрын
all good til u get banned hahaha
@user-lg3rp9hq2r2 жыл бұрын
i love this video but now that i have set it up i can't stop it from starting when i hit the button can anyone help me
what needs to be changed to make it work for "space"?
@poisonprincess42 Жыл бұрын
Why? Does it have more specifications?
@Dr.Computer3654 ай бұрын
let me make it bater using chatgpt but giveing it gui like if rinning it says running in bottom left corner of screen hear is code :) import time import threading from pynput.mouse import Controller, Button from pynput.keyboard import Listener, KeyCode import tkinter as tk TOGGLE_KEY = KeyCode(char="q") clicking = False mouse = Controller() def clicker(): while True: if clicking: mouse.click(Button.left, 1) time.sleep(5) def toggle_event(key): global clicking if key == TOGGLE_KEY: clicking = not clicking update_gui() def update_gui(): if clicking: status_label.config(text="Running", bg="#66CDAA") # Medium green else: status_label.config(text="Off", bg="#FA8072") # Medium red def start_clicker_thread(): click_thread = threading.Thread(target=clicker, daemon=True) click_thread.start() def start_listener(): with Listener(on_press=toggle_event) as listener: listener.join() # Create the GUI in the main thread root = tk.Tk() root.title("Clicker Status") # Position the window at the bottom right corner and make it smaller screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() window_width = 60 window_height = 30 root.geometry(f"{window_width}x{window_height}+{screen_width - window_width}+{screen_height - window_height}") # Use slightly darker colors for the background status_label = tk.Label(root, text="Off", bg="#FA8072", fg="white", font=("Arial", 10)) # Medium red status_label.pack(fill="both", expand=True) # Remove the window border to make it less obtrusive root.overrideredirect(True) # Keep the window always on top root.attributes("-topmost", True) # Start the clicking and listener in separate threads start_clicker_thread() threading.Thread(target=start_listener, daemon=True).start() # Start the tkinter main loop in the main thread root.mainloop()