当应用程序处于全屏模式时,AppleScript获取属性不会返回值

时间:2014-10-02 02:24:52

标签: applescript

当终端应用程序(或任何应用程序)未处于全屏模式时,此脚本有效。它将返回正确的false值。当您将应用程序设置为全屏时,它将返回任何空值。我唯一能想到的是,当你全屏显示它将它放在不同的桌面上?我现在错过了以不同的方式激活应用程序的全部内容吗?

tell application "System Events" to set the visible of every process to true
set white_list to {"Finder", "AppleScript Editor", "Google Chrome"}

tell application "System Events"
    set process_list to the displayed name of every process whose visible is true
    set process_number to (number of items in process_list)
    set myList to process_list
end tell

repeat with theItem in myList
    if theItem is not in white_list then
        log theItem
        tell application "System Events" to tell process theItem
            set isFullScreen to the value of attribute "AXFullScreen" of windows
        end tell
    end if
end repeat
return theItem & " application is FullScreen: " & isFullScreen

1 个答案:

答案 0 :(得分:0)

此行无法按照书面形式工作......

set isFullScreen to the value of attribute "AXFullScreen" of windows

“windows”将返回一个窗口列表,您无法从列表中获取该属性。所以你想把它写成......

set isFullScreen to the value of attribute "AXFullScreen" of window 1

然而,据说我试过这个,似乎你无法通过全屏幕进程获取窗口。窗口列表始终为空{}。因此,这种确定应用程序是否全屏的方法将无效。

您需要考虑另一种方法来确定应用程序是否为全屏。我尝试了几件事,找不到解决办法。遗憾。