


txt file, similarily when you double click on a. txt file, the associated text editor opens up and displays the contents of the. mcs file and can be played by double clicking on it or by even assigning a system wide shortcut key to it.

Classes with just an _init_() and one other method are often just functions disguised as classes.Macro Editor with Macro Recorder and Player Thread = Thread(target=function, args=)Īs you see there is also not need to write classes for threads if those have just an _init_() and a run() method. While not win32api.GetAsyncKeyState(win32con.VK_ESCAPE):įor function in : With Listener(on_click=partial(on_click, queue)) as listener: Why separate files when it is easier to record one file in the first place? Just put the lines from the different threads into a queue and write the contents of said queue in the main thread into a file: #!/usr/bin/env pythonįrom _future_ import absolute_import, division, print_functionĭef on_click(queue, x, y, button, pressed): While win32api.GetAsyncKeyState(win32con.VK_ESCAPE) != True:įile.write(str(datetime.now().second)+"-"+ l + "\n") With Listener(on_click=on_click, ) as listener:įile = open("posTrk.txt", "wt", encoding='UTF-8') # Write Which button is clicked to the fileįile = open("clkTrk.txt", "at", encoding='UTF-8')įile.write(str(datetime.now().second)+"-"+ button + "\n") If pressed: # Here put the code when the event occurres The only question that remains for me is if there is a way to detectĪ mouse click in a while loop with win32api? Now i need to combine it into a single file with the right order. So i am trying to use two threads to do the job.ĮDIT- Taken a bit different approach, writing the data to two files + time

The problem is i didn't find a way to detect a mouse press in a while loop with win32api. I want to build a mouse recorder that records the actions and movement the mouse makes.
