Repeat icon indicating copy to clipboard operation
Repeat copied to clipboard

Can't run generated python code

Open OrigamingWasTaken opened this issue 2 years ago • 5 comments

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.

OrigamingWasTaken avatar Dec 02 '23 22:12 OrigamingWasTaken

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?

hptruong93 avatar Dec 02 '23 23:12 hptruong93

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?

OrigamingWasTaken avatar Dec 03 '23 08:12 OrigamingWasTaken

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.

hptruong93 avatar Dec 03 '23 09:12 hptruong93

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?

OrigamingWasTaken avatar Dec 03 '23 10:12 OrigamingWasTaken

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 avatar Dec 03 '23 19:12 hptruong93

Close due to inactivity

hptruong93 avatar Mar 06 '24 18:03 hptruong93