Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyHook
- import pythoncom
- import time
- import datetime
- def onclick(event):
- record = f"{event.Position}"
- recorded = str(record)
- recorded = recorded.strip("(")
- recorded = recorded.strip(")")
- recorded = recorded.replace (" ", "")
- recorded = recorded.split(",")
- print(recorded)
- recordedX = str(recorded[0:1])
- recordedX = recordedX.strip("[")
- recordedX = recordedX.strip("]")
- recordedX = recordedX.strip("'")
- recordedY = str(recorded[1:])
- recordedY = recordedY.strip("[")
- recordedY = recordedY.strip("]")
- recordedY = recordedY.strip("'")
- print(recordedX)
- print(recordedY)
- with open ("locations.txt", "a+") as location:
- location.write(recordedX)
- location.write("\n")
- location.write(recordedY)
- location.write("\n")
- print (event.Position)
- result = datetime.datetime.now()
- print (result)
- delay_time = f"{result}"
- delay_time = delay_time[11:19]
- print (delay_time)
- #record time elapsed to txt file
- with open ("delay.txt", "a+") as delay:
- delay.write(delay_time)
- delay.write("\n")
- return True
- hm = pyHook.HookManager()
- hm.SubscribeMouseAllButtonsDown(onclick)
- hm.HookMouse()
- pythoncom.PumpMessages()
- hm.UnhookMouse()
- #start timer on first click
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement