`AXFocusedUIElement` 似乎不存在

发布于 01-12 13:25 字数 917 浏览 3 评论 0原文

我在使用相同的右键单击 Mac 脚本时遇到问题 这里。相同的步骤,尝试运行相同的 AppleScript - 即,

on run {input, parameters}

tell application "System Events" to set frontApp to name of first process whose frontmost is true
tell application "System Events"
  tell application process frontApp
    set _selection to value of attribute "AXFocusedUIElement"
    tell _selection to perform action "AXShowMenu"
  end tell
end tell
return input
end run 

在我的情况下,当我到达第二个双缩进行时,我收到以下错误:

Can’t get action "AXShowMenu" of missing value.

只是为了看看发生了什么,我添加了一行 displaydialog_selection。返回的值是:msng

换句话说,当我要求告诉 _selection 执行操作“AXShowMenu”时,_selection 似乎表明缺少值。

ps,我已经做了上述答案中提到的解决方案。

我应该使用另一个名称来获取 AXFocusedUIElement 吗?

I have a problem getting the same right-click Mac script to work as here. Same steps, trying to run the same AppleScript-- namely,

on run {input, parameters}

tell application "System Events" to set frontApp to name of first process whose frontmost is true
tell application "System Events"
  tell application process frontApp
    set _selection to value of attribute "AXFocusedUIElement"
    tell _selection to perform action "AXShowMenu"
  end tell
end tell
return input
end run 

In my case, when I get to the second double-indented line, I get the following error:

Can’t get action "AXShowMenu" of missing value.

Just to see what's happening, I added a line display dialog _selection. The value that comes back is: msng.

In other words, it seems that when I ask to tell _selection to perform action "AXShowMenu", the _selection seems to indicate a missing value.

p.s., I already did the solution named in the above-mentioned answer.

Is there another name I should use to get the AXFocusedUIElement?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文