如何从 Python 脚本中运行 AppleScript?
问题说明了一切..
(显然是在 Mac 上)
这篇好文章 http://oreilly.com/pub/a/mac/2007/05/08/using-python-and-applescript-to-get-the-most-out-of-your-mac.html建议简单的解决方案
cmd = """osascript -e 'tell app "Finder" to sleep'"""
def stupidtrick():
os.system(cmd)
虽然今天你会使用subprocess
模块而不是os.system
, 当然。
还请务必检查page 2 http://macdevcenter.com/pub/a/mac/2007/05/08/using-python-and-applescript-to-get-the-most-out-of-your-mac.html?page=2文章的更多信息和选项,包括应用脚本 http://appscript.sourceforge.net/.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)