#๐Ÿ”’ Library for Interacting with the CMD [or other solution ^^]

6 messages ยท Page 1 of 1 (latest)

keen raptor
#

Here is my project, I am creating a GUI for a TAS tool (Mario Wonder). It works as a command to enter in a server.jar. At startup it creates a CMD where you can enter commands like Start Stop, and it answers me. My goal is simply to automate this with a GUI. For now I am using PyQt5 and Keyboard. The problem is that it brings the CMD to the foreground. I would like to make the project cleaner by making everything happen in the background. I turned it on subprocess but after several tries, it is impossible to interact with a CMD page already open !

If someone can help me ^^ Actual script [Screen] I want to do all this in the background !

slim onyxBOT
#

@keen raptor

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

keen raptor
#
        self.execute_cmd_command("stop")

    def pause_game(self):
        self.execute_cmd_command("t")

    def plus_one_frame(self):
        self.execute_cmd_command("a")

    def plus_fifteen_frames(self):
        self.execute_cmd_command("a 15")
    
    def playerInfo_button(self):
        self.execute_cmd_command("p")   

    def execute_cmd_command(self, command):
        
        cmd_window = None
        for window in gw.getWindowsWithTitle("C:\\Windows\\system32\\cmd.exe"):
            cmd_window = window
            break

        if cmd_window:
            cmd_window.activate()
            pyautogui.write(command)
            pyautogui.press('enter')
            cmd_window.minimize()
            pyautogui.hotkey('alt', 'tab')```
#

Exemple of command

slim onyxBOT
#

@keen raptor

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.