AppleScript的 - 获得Windows的状态(可见或底座) [英] Applescript - Get status of windows ( Visible or in the dock )

查看:890
本文介绍了AppleScript的 - 获得Windows的状态(可见或底座)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助我的AppleScript。

I need some help for my appleScript.

有关所有打开的窗口,我想知道哪一个是隐藏的(在Dock中),其中一个是可见的,哪一个是重点?

For all open windows, I want to know which one is hidden (in the dock), which one is visible and which one is focused?

要列出窗口我使用:

tell application "System Events"
    set procs to processes
    set windowName to {}
    repeat with proc in procs
        try
            if exists (window 1 of proc) then
                repeat with w in windows of proc
                        copy w's name to the end of windowName
                end repeat
            end if
        end try -- ignore errors
    end repeat
end tell
return windowName

我试着集中的属性:

I tried focused property:

copy w's focused to the end of windowName

和选定的属性:

copy w's selected to the end of windowName

但是,这并不工作!

But this doesn't work!

感谢您的帮助!

推荐答案

在Mac OS X 10.6(2.1.2的AppleScript)的说明 A <$ C $财产C>窗口申请流程> (在系统活动'而言)对话如果小型化的窗口(在Dock中),以及其他一些值(如标准窗口,但也可以是根据不同的应用程序),如果它不是小型化的不同的东西。

On Mac OS X 10.6 (AppleScript 2.1.2) the description property of a window of an application process (in System Events' terms) is "dialog" if the window is miniaturized (in the Dock), and some other value (such as "standard window", but can be something different depending on the application) if it's not miniaturized.

当某个应用程序的隐藏共(使用 CMD + H 或隐藏从应用程序的菜单命令)的所有其窗户的将被隐藏,而不管他们是否缩小或没有,所以要找出是否是隐藏的,用

When an application is hidden altogether (using cmd+H or the "Hide" command from the application's menu), all of its windows will be hidden, regardless of whether they were miniaturized or not, so to find out whether it's hidden, use

visible of application process "<ProcessName>"

这是假,当应用程序被隐藏。要取消隐藏它,该属性设置为真正

It's false when the application is hidden. To un-hide it, set that property to true.

要找出哪个应用程序的窗口,目前主要集中(最前面/激活),用

To find out which window of an application is currently focused (frontmost/active), use

window 1 of application process "<ProcessName>"

应用程序的窗口的列表(由应用程序的窗口返回... )由垂直堆叠下令:最前面的窗口是第一,一个在后面它是第二,等等。

The list of windows of an application (returned by windows of application process...) is ordered by the vertical stack: the frontmost window is first, the one behind it is second, and so on.

由于OS X只有一个应用程序是最前端的时间,只有一个窗口是在前台,你会得到在这样当前焦点窗口:

Since in OS X only one application is frontmost at a time, and only one window is in the foreground, you'll get at the currently focused window like this:

window 1 of (first application process whose frontmost is true) 

这篇关于AppleScript的 - 获得Windows的状态(可见或底座)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆