使用 AppleScript 在 Mac OSX Lion 上单击菜单项 [英] Click menu item on Mac OSX Lion using AppleScript

查看:48
本文介绍了使用 AppleScript 在 Mac OSX Lion 上单击菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Mac OSX 10.7.3 上使用简单的 AppleScript 时遇到问题.使用以下简单的 AppleScript,我发现到处都是 OSX 引发错误操作运行 AppleScript"遇到错误"

我打开 Automator,创建一个服务,放入运行 AppleScript"节点并输入以下我认为正确的代码,因为正如我所说,这是很多人没有任何抱怨的做法.

AppleScript:

<块引用>

告诉应用程序终端"激活告诉应用程序系统事件"告诉进程终端"单击菜单栏 1 的菜单外壳"的菜单项新窗口"告诉应用程序终端"关闭前窗口结束告诉结束告诉

在 Automator 中运行时,我也收到错误说明:

运行 AppleScript 失败 -1 错误辅助设备的访问被禁用"

解决方案

是否启用了Enable access for assive devices?如果是这样,您是否尝试过重新启用它?

I have a problem using a simple AppleScript on Mac OSX 10.7.3. With the following simple AppleScript which I find everywhere OSX raises an error 'The action "Run AppleScript" encountered an error'

I open up the Automator, create a Service, drop in a "Run AppleScript" node and enter the following code which I assume is correct because as I said it is the way a lot of people are doing it without any complaints.

AppleScript:

tell application "Terminal" to activate
    tell application "System Events"
        tell process "Terminal"
            click menu item "New Window" of menu "Shell" of menu bar 1
            tell application "Terminal" to close the front window
        end tell
end tell

EDIT: When running in Automator I also get an error description:

Run AppleScript failes -1 error
Access for assistive devices is disabled"

解决方案

Is Enable access for assistive devices enabled? If so, have you tried to reenable it?

这篇关于使用 AppleScript 在 Mac OSX Lion 上单击菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆