0

我在从 python (Mac OS X 10.7.3) 运行 applescript 时遇到问题。实际上,我可以运行 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"'])

是的,“启用辅助设备访问”已启用,我还尝试禁用它并再次启用它(无需重新启动)。

谢谢!

4

0 回答 0