Because of some overly-enthusiastic self-written clean script on my Mac I have run into a very specific problem: all my applications are refusing to open 2nd windows, e.g. 'save file', 'open file', 'export file' windows. On some applications the 'save file' windows do open, but when I try to change the directory of where to save the file the window will disappear again and it will not come back afterwards unless I restart OSX.

I have been trying to figure out if there is any specific systemprocess that is responsible for opening/displaying these kind of windows, but I have not yet been able to find one.

I have however come across this python code on GitHub and it has helped me to see that the windows I am talking are about are indeed still being opened, but they are simply not displayed.

I will take Safari as an example. When I run Safari, the script shows the following output:

PID   WID x,y,w,h                   [Title] Subtitle
502   110 {385,104,160,18       }   [Safari] 
502    97 {426,57,590,96        }   [Safari] 
502    96 {1,23,1439,851        }   [Safari] How to force window size via command line by windowid? - Ask Different
502    95 {0,0,1440,22          }   [Safari]
502    94 {0,0,1440,22          }   [Safari]

Now, when I press (in Safari) Archive --> Save as...nothing appears to be happening. But when I run the mentioned script again, the output reads as follows:

PID   WID x,y,w,h               }   [Title] Subtitle
502   169 {104,22,216,341       }   [Safari] Archive
502   168 {45,22,188,239        }   [Safari] 
502   110 {254,237,86,18        }   [Safari] 
502    97 {426,57,590,96        }   [Safari] 
502    96 {1,23,1439,851        }   [Safari] How to force window size via command line by windowid? - Ask Different
502    95 {0,0,1440,22          }   [Safari]
502    94 {0,0,1440,22          }   [Safari]

I am assuming that this line:

502   169 {104,22,216,341       }   [Safari] Archive

Indicates that the 'Save file window' has indeed been activated. It had been labelled as windowID 169 and its dimensions(x,y,w,h) are 104,22,216,341.

Could someone tell me:

What are the usual 'visible dimensions' (x,y,w,h) for OSX windows and how can I force those values to change to a given input via the command line once I know the windowID?

Many thanks!

EDIT: Just discovered over here that it is possible to set the bounds of a window via applescript/osascript, so I am getting close.

However, in relation to my Safari example, this only works if I can tell Safari to set the bounds of the first, second, etc. window. As the above-mentioned output shows, my Safari is running at least 5 different windows (or at least, it has claimed 5 windowID's). But running:

osascript -e 'tell application "Safari" to properties of every window'

revealed that Safari only indexed two of them:

document:document MacScripter / Call application by ID instead of by Name, closeable:true, zoomed:true, class:window, index:1, visible:true, name:MacScripter / Call application by ID instead of by Name, modal:false, miniaturizable:true, titled:true, id:1045, miniaturized:false, floating:false, resizable:true, bounds:0, 23, 1440, 875, current tab:tab 2 of window id 1045, zoomable:true, document:missing value, closeable:false, zoomed:true, class:window, index:2, visible:false, name:, modal:false, miniaturizable:false, titled:false, id:1057, miniaturized:false, floating:false, resizable:false, bounds:425, 57, 1015, 104, zoomable:false

So I am still not able to set the visibility and size of the 'Archive' window.

  • Please add the "clean script" content (or add a link to it), which might reveal/explain what happened to your system... – klanomath Dec 2 '16 at 22:17
  • Ah, well yes, forgot to mention: that specific script ended up deleting itself :$. The problem has however solved itself after multiple reboots. During one specific bootup the progressbar seemed to be stuck, but eventually continued all by itself. Once OSX was up and running again, the above mentioned problem had been resolved.. – Montmons Dec 18 '16 at 14:29

You must log in to answer this question.

Browse other questions tagged .