How to start and close the program on the mac system through python, please provide a script example

Using Python, you can start and close programs on the Mac system by calling the AppleScript application provided by the Mac OS X system. Here is an example of a simple script that can help you do this: import subprocess

start the application

subprocess.call(['osascript','-e','tell application "AppName" to launch'])

close the application

subprocess.call(['osascript','-e','tell application "AppName" to quit'])

Guess you like

Origin blog.csdn.net/weixin_35757531/article/details/129593986