how to make a button spammer in python

Solutions on MaxInterview for how to make a button spammer in python by the best coders in the world

showing results for - "how to make a button spammer in python"
Marlon
25 Feb 2016
1import time
2import keyboard
3
4# Start of script
5start_timer = input("How long would you like the start timer to be? In seconds please ")
6space_between_spam = input("How long would you like the space between each keystroke? In seconds please ")
7pressed_key = input("What key do you want to spam? ")
8
9# Crash Prevention
10key_crash_stopper = pressed_key.split()
11len_crash = len(key_crash_stopper)
12substring = input("One more time, please ")
13count = pressed_key.count(substring)
14if pressed_key == substring:
15    print("To stop, press 's'")
16    print("starting in", start_timer, "Seconds")
17    time.sleep(int(start_timer))
18    while True:
19        keyboard.press(pressed_key)
20        time.sleep(float(space_between_spam))
21else:
22    print("Please type the same letters!")
23
24if count != 1:
25    print("Only one letter!")
26    exit()
27
28if len_crash > 1:
29    print("Only one letter!")
30    exit()
31
Micaela
03 Jul 2020
1import time
2import keyboard # pip install keyboard
3
4# Start of script
5start_timer = input("How long would you like the start timer to be? In seconds please ")
6space_between_spam = input("How long would you like the space between each keystroke? In seconds please ")
7pressed_key = input("What key do you want to spam? ")
8
9# Crash Prevention
10key_crash_stopper = pressed_key.split()
11len_crash = len(key_crash_stopper)
12substring = input("One more time, please ")
13count = pressed_key.count(substring)
14if pressed_key == substring:
15    print("To stop, press 's'")
16    print("starting in", start_timer, "Seconds")
17    time.sleep(int(start_timer))
18    while True:
19        keyboard.press(pressed_key)
20        time.sleep(float(space_between_spam))
21else:
22    print("Please type the same letters!")
23
24if count != 1:
25    print("Only one letter!")
26    exit()
27
28if len_crash > 1:
29    print("Only one letter!")
30    exit()
31