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.

1 Answer 1


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:

tell application "Finder" to set the bounds of window 1 to {325, 465, 1095, 926}

The numbers are the coordinates in pixels of the top left and bottom right of the the window:

  1. top left corner x
  2. top left corner y
  3. bottom right corner x
  4. bottom right corner y

If you set the windows as you like them, you can use applescript to tell you the current bounds:

tell application "Finder" to get the bounds of window 1

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:

tell application "Finder" to get the name of window 1
tell application "Finder" to set the bounds of window "name" to {325, 465, 1095, 926}

Update: Coordinates for multiple monitors behave as though a single large display were present.

  • I had already jumped over to AppleScript anyway so I could add a couple other features to the script. This looks very promising!
    – hairboat
    Aug 29, 2014 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .