I have a script that opens three shortcuts to VNC locations that open in Screen Sharing.app. I would like to specify where the windows go, and their size, when these screenshares launch – one maximized on my main monitor, and two overlapping on my secondary monitor.
Is there a key I can use with the open
command that will allow me to specify this? If not, how else could I accomplish this?
Update: I'm now using AppleScript instead of a shell script, but the purpose is the same.
Best Answer
Having a look at the man page for
open
, it doesn't seem to allow it, but you can use applescript to resize and position windows:The numbers are the coordinates in pixels of the top left and bottom right of the the window:
If you set the windows as you like them, you can use applescript to tell you the current bounds:
The window numbers are assigned going from front to back, starting at 1.
If you prefer, you can also refer to windows by name instead of id, though this won't work if the name of the window is different every time:
Update: Coordinates for multiple monitors behave as though a single large display were present.