MacOS – osascript “set bounds of window” not working after Mavericks upgrade

applescriptbashmacos

I have a number of bash functions I run at the beginning of each day to start work. They all look pretty much like this:

mind() {
  osascript -e 'tell app "Terminal"
    do script "ssh -A user@my.server.net"
    set bounds of window 1 to {50, 50, 1200, 900}
  end tell'
}

After upgrading to Mavericks, this is mostly working, but it doesn't position the lower-right corner of the window. That is, it positions the top left corner of the new window at 50, 50, but fails to resize the window.

I have reinstalled XQuartz and have it running. How can I get this to resize properly? Did Mavericks change the way bash talks to AppleScript/XQuartz?

Best Answer

Try changing the size and position attributes or using System Events instead:

tell application "Terminal"
    tell window 1
        set size to {1150, 850}
        set position to {50, 50}
    end tell
end tell
tell application "System Events" to tell process "Terminal"
    tell window 1
        set size to {1150, 850}
        set position to {50, 50}
    end tell
end tell