`AXFocusedUIElement` 似乎不存在
我在使用相同的右键单击 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论