Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import win32gui, win32api, win32con, random, pythoncom
- from win32api import GetSystemMetrics
- from time import sleep as s
- from os import system as cmd
- def ps():
- cmd("pause")
- def clear():
- cmd("cls")
- window = win32gui.GetForegroundWindow()
- def minimize():
- win32gui.ShowWindow(window, win32con.SW_MINIMIZE)
- def maximize():
- win32gui.ShowWindow(window, win32con.SW_MAXIMIZE)
- def restore():
- win32gui.ShowWindow(window, win32con.SW_RESTORE)
- def click(x,y):
- win32api.SetCursorPos((x,y))
- win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
- win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
- def randomScreenClick(amount=50,time=0.5):
- for i in range(amount):
- x = random.randint(1, GetSystemMetrics (0))
- y = random.randint(1, GetSystemMetrics (1))
- click(x,y)
- s(time)
- #This clicks mouse randomly throughout entire screen.
- #Makes a good prank if you compile it to an executable and put in your victim's startup folder
- def randomZoneClick(x1,y1,x2,y2,amount=100,time=0.02):
- for i in range(amount):
- x = random.randint(x1,x2)
- y = random.randint(y1,y2)
- click(x,y)
- s(time)
- #USAGE:
- #randomZoneClick(x1,y1,x2,y2,amount,time)
- #EXAMPLE:
- #randomZoneClick(483, 353, 628, 504, 100, 0.2)
- #where:
- #483, 353 = first coordinate
- #628, 504 = second coordinate
- #100 = amount of times it clicks
- #0.2 = time between clicks (in seconds)
- #TO DO:
- #If amount is 0, do indefinitely (this could be bad)
- #Actually now that I think about it, This could be really bad
- #Unstoppable clicking for ever.
- #As a matter of fact, Just forget about this, I don't want to break stuff
- #use pointergetter.py to get cursor location. Source code below.
- '''
- import win32gui,pyperclip
- from time import sleep as s
- from os import system as p
- print ("You have5 seconds to move mouse to position\n")
- s(5)
- POSITION = win32gui.GetCursorPos()
- print POSITION
- pyperclip.copy(POSITION)
- p("pause")
- '''
- #^^^ Save that as it's own .py file and run it.
- #Once run, You will have 5 seconds to move mouse to desired location,
- #it will print the cursor's coordinates and copy it to your clipboard.
- #Run it a second time for coordinate #2
- def start(timew8=1):
- print "Resolution: "+ str(GetSystemMetrics (0))+", "+ str(GetSystemMetrics (1))
- print "\n\nGET POSITION 1\n\nOnce you continue, you will have "+str(timew8)+" second(s) to move cursor to desired position."
- ps()
- minimize()
- s(timew8)
- POSITION1 = win32gui.GetCursorPos()
- restore()
- print "\n\n\nPosition 1: "+str(POSITION1)
- print "\n\nGET POSITION 2\n\nOnce you continue, you will have "+str(timew8)+" second(s) to move cursor to desired position."
- ps()
- minimize()
- s(timew8)
- POSITION2 = win32gui.GetCursorPos()
- restore()
- print "\n\nPosition 2: "+str(POSITION2)
- coordinates = POSITION1+POSITION2
- print "\nCoodinates: "+str(coordinates)
- amounts = raw_input("\n\nPlease enter desired amount and time with a space like this:\n'100 0.02' (<-- these are defaults. Don't type anything and these will be used.)\n\n>")
- if amounts != "":
- amt = amounts.split(' ')
- a5 = int(amt[0])
- if '.' in amt[1]:
- a6 = float(amt[1])
- else:
- a6 = int(amt[1]) #allowing floats and ints
- else:
- a5 = 100
- a6 = 0.02
- print("\nWill now randomize mouse clicks.\n")
- ps()
- a1,a2,a3,a4 = coordinates[0],coordinates[1],coordinates[2],coordinates[3]
- minimize()
- randomZoneClick(a1,a2,a3,a4,a5,a6)
- restore()
- print "\n\nRandomizing complete.\n"
- ps()
- clear()
- start()
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement