I wrote a macro that use key-presses to record.
It is using the keyboard module that does not work on macOS.
Code
import time
import keyboard
import pyautogui
while True:
if keyboard.is_pressed('e'):
#recording
v = [0]
z = True
m = time.time()
while z == True:
if keyboard.is_pressed('space'):
v.append(time.time() - m)
elif keyboard.is_pressed('e'):
print("Stopped recording")
z = False
print(v)
elif keyboard.is_pressed('x'):
#replaying
pyautogui.click()
for b in range(len(v)-1):
time.sleep(v[b + 1] - v[b])
pyautogui.keyDown('space')
elif x == "q":
#if key 'q' is pressed, it stops
break
I tried to use pynput but without success to detect key presses in the second while loop.
How to modify the code so it can work on mac?