我在运行python的Applecript时遇到问题(Mac OS X 10.7.3)。实际上,我可以运行applescript但是某个部分不起作用。特别是,我试图点击应用程序中的菜单项:
args = ['osascript', '-e', 'tell app "StataMP" to activate']
args.extend(['-e', 'tell application "System Events" to tell application process "StataMP" to click menu item "run tmp file" of menu 1 of menu item "Applescript helpers" of menu 1 of menu bar item "User" of menu bar 1'])
subprocess.Popen(args)
我还尝试了一个更简单的版本来测试脚本但没有成功:
args.extend(['-e', 'tell application "System Events" to tell process "StataMP" to tell menu bar 1 to tell menu bar item "Window" to click menu item "Zoom"'])
是的,'启用辅助设备访问'已启用,我也尝试禁用它并再次启用它(不重新启动)。
谢谢!