• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: zoomed attribute of tabbed fullscreen windows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: zoomed attribute of tabbed fullscreen windows


  • Subject: Re: zoomed attribute of tabbed fullscreen windows
  • From: 2551phil <email@hidden>
  • Date: Sun, 15 Oct 2017 15:05:50 +0700

> On 14 Oct 2017, at 18:41, Jean-Christophe Helary
> <email@hidden> wrote:
>
> I think I found a simple solution


Cool, but I’d like to explore this is a bit further as it’s a specific example
of a more general problem that could do with a solution: how to determine which
apps/windows are in full screen across multiple displays?

As a proof of concept, the following works here on a dual display setup with
multiple spaces. It correctly returned the full screen windows for all my
running apps. It also appears to cope with split screen situations, too.

I’m sure Shane or others can improve upon my sloppy scripting style though. :p





use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

#######################
-->> VARIABLES
#######################
set fullScreenApps to {}
set msg to "None"

#######################
-->> HANDLERS
#######################

on hasFullScreen:theApp forWindow:aWin
        set theReply to {false, 0, missing value}
        tell application theApp
                try
                        set yPos to item 2 of (get bounds of window aWin)
                on error
                        set yPos to 1
                end try
                if yPos is 0 then
                        try
                                set winName to window aWin's name
                        on error
                                set winName to missing value
                        end try
                        set theReply to {true, aWin, winName}
                end if
        end tell
        return theReply
end hasFullScreen:forWindow:


on getVisibleProcs()
        set visibleProcs to {}
        tell application "System Events"
                set procs to every application process
                repeat with i from 1 to count of procs
                        set this_proc to item i of procs
                        try
                                if this_proc's visible is true then
                                        set end of visibleProcs to this_proc's
name
                                end if
                        end try
                end repeat
        end tell
        return visibleProcs
end getVisibleProcs

#######################
-->> COMMANDS
#######################

set currentApps to getVisibleProcs()
repeat with a from 1 to count of currentApps
        set this_app to currentApps's item a
        try
                tell application this_app
                        set wc to count of its windows
                        repeat with w from 1 to wc
                                set hasFs to (my hasFullScreen:this_app
forWindow:w)
                                if hasFs's item 1 is true then
                                        set end of fullScreenApps to {this_app,
hasFs's item 2, hasFs's item 3}
                                end if
                        end repeat
                end tell
        end try
end repeat

if (count of fullScreenApps) is greater than 0 then
        set msg to ""
        repeat with i from 1 to count of fullScreenApps
                set this_item to item 1 of item i of fullScreenApps as text
                set this_item to this_item & "'s Window " & item 2 of item i of
fullScreenApps as text
                set this_item to this_item & ":  " & item 3 of item i of
fullScreenApps as text
                set msg to msg & this_item & return
        end repeat
end if
display dialog msg with title "Windows that are in full screen" buttons "OK"
default button "OK"







Best


Phil
@sqwarq
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: zoomed attribute of tabbed fullscreen windows
      • From: Jean-Christophe Helary <email@hidden>
    • Re: zoomed attribute of tabbed fullscreen windows
      • From: 2551phil <email@hidden>
References: 
 >zoomed attribute of tabbed fullscreen windows (From: Jean-Christophe Helary <email@hidden>)
 >Re: zoomed attribute of tabbed fullscreen windows (From: 2551phil <email@hidden>)
 >Re: zoomed attribute of tabbed fullscreen windows (From: Jean-Christophe Helary <email@hidden>)

  • Prev by Date: Re: Awful bugs in HS Mail
  • Next by Date: Re: zoomed attribute of tabbed fullscreen windows
  • Previous by thread: Re: zoomed attribute of tabbed fullscreen windows
  • Next by thread: Re: zoomed attribute of tabbed fullscreen windows
  • Index(es):
    • Date
    • Thread