I noticed when getting all windows that there are extra window items returned than there are. For example for Safari, it returns 9 windows but there are only 3 windows open; all the others are randomly created as far as I can tell. Below is screenshot of properties of on of these windows.

The code I used was very straightforward:

tell application "Safari"
    set allWindows to get windows
# Below is code that you can run to get these windows if they exist.
    set imaginaryWindows to {}
    repeat with i from 1 to (count of allWindows)
        if name of (item i of allWindows) is equal to "" then
            copy (item i of allWindows) to end of imaginaryWindows
        end if
    end repeat

log (count of imaginaryWindows)
end tell

I was wondering if anyone else have these windows? If yes, then what are they, and why do they exist? Is it a bug?

I've also noticed this being the case for Terminal, and Script Editor windows.

Fake Window

  • All I can add is yes, I get some imaginary windows - but, not straight after launch [even if everything is set to restore the last session]. Perhaps it's remembering windows opened then closed? Edit - nope, after a second test it did remember a phantom after a fresh launch... bang goes my theory ;) – Tetsujin Mar 11 '16 at 11:06
  • @Tetsujin Thanks for confirming that, I was going nuts here. – user14492 Mar 11 '16 at 16:38

You must log in to answer this question.

Browse other questions tagged .