How i can send the commands from keyboards using python. I am trying to automate mac app (GUI)

前端 未结 2 606
一个人的身影
一个人的身影 2021-01-27 04:58

I am trying to automate a app using python. I need help to send keyboard commands through python. I am using powerBook G4.

2条回答
  •  遥遥无期
    2021-01-27 05:34

    You could call AppleScript from your python script with osascript tool:

    import os
    cmd = """
    osascript -e 'tell application "System Events" to keystroke "m" using {command down}' 
    """
    # minimize active window
    os.system(cmd)
    

提交回复
热议问题