Apple脚本 - 使目标窗口始终位于顶部

时间:2016-04-30 21:36:06

标签: applescript

我正在尝试编写一个苹果脚本,在执行时,会使当前关注的窗口始终位于顶部"。这可能吗?

在objective-c中我可以通过使用[NSWindow setLevel:]在我的进程拥有的Windows上执行此操作,但我的努力是为我的进程不拥有的Windows执行此操作。所以我现在正试图通过苹果脚本来做。

我试过了:

global frontApp, frontAppName, windowTitle
delay 3
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
        set level of window 1 to 3
        tell window 1
            set windowTitle to value of attribute "AXTitle"
        end tell
    end tell
end tell

return {frontAppName, windowTitle}

然而这给了我错误 -

  

系统事件出错:无法进入进程窗口1的级别" firefox"到类型说明符。

0 个答案:

没有答案
相关问题