在applescript中获取当前的adobe reader窗口标题

发布于 2024-11-27 08:34:21 字数 287 浏览 4 评论 0原文

我编写了以下代码片段来获取 Firefox 窗口的标题,

tell application "Firefox"
    set window_name to name of front window
    display dialog window_name

end tell

它运行良好,但是当我将 Firefox 更改为 Adob​​e 时,出现以下错误

“Adobe Reader 出现错误:无法获取窗口 1 的名称”。

有人知道如何获取窗口标题吗?

I wrote the following snippet to get the title of the firefox window,

tell application "Firefox"
    set window_name to name of front window
    display dialog window_name

end tell

it's working well, but when I change firefox to adobe, I get the following error

"Adobe Reader got an error: Can’t get name of window 1."

Any one knows how to get the window title?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

欢烬 2024-12-04 08:34:21

你已经把答案写在问题里了!

tell application "System Events" to set adobe_windows to (get the title of every window of every process whose name contains "Adobe") as list
set prevTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to {", "}
set adobe_windows to adobe_windows as string
display dialog adobe_windows
set AppleScript's text item delimiters to prevTIDs

当我遇到涉及窗口标题的错误时,我会前往系统事件寻求帮助。这甚至适用于 Finder! 系统事件 可以完成 Finder 可以完成的所有操作,有时甚至更多。如果您有任何疑问,请尽管询问。 :)

You kind of wrote the answer in the question!

tell application "System Events" to set adobe_windows to (get the title of every window of every process whose name contains "Adobe") as list
set prevTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to {", "}
set adobe_windows to adobe_windows as string
display dialog adobe_windows
set AppleScript's text item delimiters to prevTIDs

When I get errors referring to window titles, I go to System Events for help. This even applies to the Finder! System Events can do everything the Finder can do, and sometimes more. If you have any questions, just ask. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文