repeats / Repeat

Cross-platform mouse/keyboard record/replay and automation hotkeys/macros creation, and more advanced automation features.
Apache License 2.0
1.03k stars 76 forks source link

Can't run generated python code #46

Closed OrigamingWasTaken closed 5 months ago

OrigamingWasTaken commented 8 months ago

Hi, I'm trying to run compiled python code but I cannot find the "key_code" module anywhere. Sorry if this question is dumb but I've been struggling for an hour now and I can't find anything talking about this.

hptruong93 commented 8 months ago

Did you mean this? https://github.com/repeats/Repeat/blob/master/src/staticContent/natives/python/key_code.py

The template code is here https://github.com/repeats/Repeat/blob/master/src/staticContent/natives/python/template_repeat.py

Does the default template not compile and run? What error did you see?

OrigamingWasTaken commented 8 months ago

Oh sorry it runs on the webpage but I thought it would be possible to embed the py code in another program... Is this a possible?

hptruong93 commented 8 months ago

This python code is run when there's a task activation trigger. You can definitely make this program interact with another program. If you tell me more about your scenario, I can let you know what you need.

In particular, you can make this program interact with another program using the following way: 1) Call your program as a subprocess inside the python code. 2) Send a signal to your program (via socket or HTTP if your program is a server). 3) Let your program invoke this python code by setting a shared variable. A shared variable can be set using the CLI.

OrigamingWasTaken commented 8 months ago

I wanted to generate python code to embed it in my tkinter gui (macro lib for a game) Is there really no way of running the compiled code without having the jar opened?

hptruong93 commented 8 months ago

Unfortunately, this Repeat program is not a library, so you can't use it inside your GUI without running the jar in the background. What you're looking for is a Python library. Perhaps https://pyautogui.readthedocs.io/en/latest/ is the one that you need.

What you can do with the generated code is to convert it to using pyautogui interface, then you'll be able to run it in your program without running the jar. That said, I'm not sure why you need to generate the code in the first place? Can't you just write that code yourself (albeit being very manual)?

hptruong93 commented 5 months ago

Close due to inactivity