Last active
March 19, 2023 21:58
-
-
Save Lampe2020/ad058d6d88f110d25bf62a37de616680 to your computer and use it in GitHub Desktop.
Revisions
-
Lampe2020 revised this gist
Mar 19, 2023 . 2 changed files with 16 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ #!/usr/bin/env xdg-open [Desktop Entry] Encoding=UTF-8 Version=1.0 Name=Autoclicker Type=Application Icon=python3 Exec=python3 autoclicker.py # Requires local copy of the script but no internet connection. 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ #!/usr/bin/env xdg-open [Desktop Entry] Encoding=UTF-8 Version=1.0 Name=Autoclicker Type=Application Icon=python3 Exec=bash -c "curl -H 'Cache-Control: no-cache, no-store' https://gist.github.com/Stehlampe2020/ad058d6d88f110d25bf62a37de616680/raw/autoclicker.py | python3" -
Lampe2020 revised this gist
Mar 19, 2023 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -20,17 +20,17 @@ def __init__(self): # Create a multiple-choice box button_menu = Gtk.ComboBoxText() button_menu.insert(0, "1", "Left click") button_menu.insert(1, "2", "Middle click") button_menu.insert(2, "3", "Right click") button_menu.set_active(0) # Create a number selection box interval_spinner = Gtk.SpinButton.new_with_range(0, 3333, 1) interval_spinner.set_value(1) # Create a button start_button = Gtk.Button(label="Start/Stop") start_button.connect("clicked", self.init_autoclicker, button_menu, interval_spinner) # Attach widgets to grid -
Lampe2020 revised this gist
Mar 19, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -60,9 +60,9 @@ def click(self): ... def init_autoclicker(self, button, button_menu, interval_spinner): if not self.currently_running_process: self.button = int(button_menu.get_active_id()) self.interval = interval_spinner.get_value_as_int() self.currently_running_process = multiprocessing.Process(target=self.click) self.currently_running_process.start() else: -
Lampe2020 revised this gist
Mar 19, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ class MainWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Autoclicker") self.set_border_width(10) self.currently_running_process = None self.button = 1 -
Lampe2020 created this gist
Mar 19, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,76 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- import gi, time, os, random, multiprocessing gi.require_version("Gtk", "3.0") from gi.repository import Gtk class MainWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Autoklicker") self.set_border_width(10) self.currently_running_process = None self.button = 1 self.interval = 1 self.method = 'click' # Create a grid grid = Gtk.Grid() self.add(grid) # Create a multiple-choice box button_menu = Gtk.ComboBoxText() button_menu.insert(0, "1", "Vänster") button_menu.insert(1, "2", "Mitten") button_menu.insert(2, "3", "Höger") button_menu.set_active(0) # Create a number selection box interval_spinner = Gtk.SpinButton.new_with_range(0, 3333, 1) interval_spinner.set_value(1) # Create a button start_button = Gtk.Button(label="Starta/Stoppa") start_button.connect("clicked", self.init_autoclicker, button_menu, interval_spinner) # Attach widgets to grid grid.attach(button_menu, 0, 0, 1, 1) grid.attach(interval_spinner, 1, 0, 1, 1) grid.attach(start_button, 0, 1, 2, 1) # Close the clicker process on window close self.connect('destroy', Gtk.main_quit) self.connect('delete-event', (lambda self, widget=None, *data: self.currently_running_process.terminate())) def click(self): if not self.button in (1, 2, 3) or not type(self.interval) == int: return {'button': self.button, 'interval': self.interval} match self.method: case 'mousedown': while True: time.sleep(self.interval + random.random()) # Use additional random delay to avoid detection os.system(f'xdotool mousedown {self.button}') time.sleep(random.random() / 10) os.system(f'xdotool mouseup {self.button}') case 'click': while True: time.sleep(self.interval + random.random()) # Use additional random delay to avoid detection os.system(f'xdotool click {self.button}') case _: ... def init_autoclicker(self, button, button_menu, interval_spinner): button_value = int(button_menu.get_active_id()) interval_value = interval_spinner.get_value_as_int() if not self.currently_running_process: self.currently_running_process = multiprocessing.Process(target=self.click) self.currently_running_process.start() else: self.currently_running_process.terminate() self.currently_running_process.join() self.currently_running_process = None win = MainWindow() win.connect("destroy", Gtk.main_quit) win.show_all() Gtk.main()