Skip to content

Commit

Permalink
add command line options
Browse files Browse the repository at this point in the history
  • Loading branch information
mircea007 committed Jun 14, 2022
1 parent 48e5cef commit 58ae5b4
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import random # to throw off bot detection
import pynput.mouse as mouselib # mouse library
import pynput.keyboard as kblib # keyboard library
import sys
import sys, getopt

IS_WINDOWS = (sys.platform == 'win32')

Expand All @@ -15,10 +15,6 @@

LOF_PREFIX_INFO = "(\u001b[32m*\u001b[0m) "

print( LOF_PREFIX_INFO + "Running " + [ "Linux", "Windows" ][IS_WINDOWS] + " version" )
print( LOF_PREFIX_INFO + "To end atuoclicker press the END key" )
print( LOF_PREFIX_INFO + "To start autoclicking turn on Caps Lock and hold the left or right mouse button" )

# autoclicker class
class AutoClicker:
@staticmethod
Expand Down Expand Up @@ -112,9 +108,36 @@ def end( self ):

self.thread.join()

auto_left = AutoClicker( 1 ) # left
#auto_middle = AutoClicker( 2 ) # middle
auto_right = AutoClicker( 3 ) # right
def usage():
print( f"usage: {sys.argv[0]} [-h] [--cps CPS] [--delta DELTA]" )
print( " -h prints this page" )
print( " CPS clickrate, a positive number (not only integers)" )
print( " DELTA maximum delay deviation, a number between 0 and 1" )
sys.exit( 1 )

try:
opts, args = getopt.getopt( sys.argv[1:], "h", [ "cps=", "delta=" ] )
except getopt.GetoptError:
usage()

cps = 10.0
delta = 0.3

for opt, arg in opts:
if opt == '-h':
usage()
elif opt == '--cps':
cps = float( arg )
elif opt == '--delta':
delta = float( arg )

print( LOF_PREFIX_INFO + "Running " + [ "Linux", "Windows" ][IS_WINDOWS] + " version" )
print( LOF_PREFIX_INFO + "To end atuoclicker press the END key" )
print( LOF_PREFIX_INFO + "To start autoclicking turn on Caps Lock and hold the left or right mouse button" )

auto_left = AutoClicker( 1, cps, delta ) # left
#auto_middle = AutoClicker( 2, cps, delta ) # middle
auto_right = AutoClicker( 3, cps, delta ) # right

def ragequit():
global auto_left
Expand Down

0 comments on commit 58ae5b4

Please sign in to comment.