Applescript - Get status of windows ( Visible or in the dock )

Posted by user1329172 on Stack Overflow See other posts from Stack Overflow or by user1329172
Published on 2012-04-14T17:24:11Z Indexed on 2012/04/14 17:29 UTC
Read the original article Hit count: 131

Filed under:
|

I need some help for my appleScript.

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

To list windows I use :

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

and selected property:

copy w's selected to the end of windowName

But this doesn't work!

Thanks for help!

© Stack Overflow or respective owner

Related posts about osx

Related posts about applescript