【问题标题】:AppScript to get main window Title of the frontmost windowAppScript to get main window Title of the frontmost window
【发布时间】:2022-12-01 14:08:42
【问题描述】:

I am using apple script to get frontmost app window title. However I can get the frontmost window but not the main window of the app. How can I do it with Apple Script?

Script:

delay 2

global frontApp, frontAppName, windowTitle

set windowTitle to ""
tell application "System Events"
    set frontApp to first application process whose frontmost is true
    set frontAppName to name of frontApp
    tell process frontAppName
        tell (1st window whose value of attribute "AXMain" is true)
            set windowTitle to value of attribute "AXTitle"
        end tell
    end tell
end tell

return windowTitle

In MSWord With this script I can get the name Document1 when there is no modal window in the main window. But If there is an model window for example Insert Table I am able to get the title Insert Table instead of Document1. But I need the main window title but not model window/sub windows.

Please help to to achieve this. Thank you

【问题讨论】:

  • Hi, did you find the answer to your question? I am trying to do the same thing.
  • @AriG No I didn't found

标签: macos applescript


【解决方案1】:

You can find a solution here:

Link

【讨论】:

    猜你喜欢
    • 2022-12-19
    • 2022-12-02
    • 2011-01-13
    • 2020-06-24
    • 1970-01-01
    • 2022-12-27
    • 2022-12-01
    • 2022-12-27
    • 2022-12-26
    相关资源
    最近更新 更多