views:

123

answers:

1

I am trying to create a small AppleScript to create and move some Terminal windows around my screen. The problem I am running into is that in some cases, it seems that OS X is ignoring the bounds I am setting.

Using the AppleScript Editor:

tell application "Terminal" to set the bounds of the first window to {0, 50, 600, 700}
tell application "Terminal" to get the bounds of the first window

Shows the following in the Event Log:

tell application "Terminal"
    activate
    set bounds of window 1 to {0, 50, 600, 700}
    get bounds of window 1
        --> {0, 22, 600, 672}
end tell
Result:
{0, 22, 600, 672}

Visually inspecting the window that is created when the script runs shows that Result bounds are the ones being used by the window.

Any ideas?

Edit: Running 10.6.3. My screen size is 1280 X 800. Finder reports the bounds of the desktop window to be {0, 0, 1280, 800}

+1  A: 

I hit the same problem today. Not sure what the real cause is, but the workaround is to add an extra "set position" after set bounds:

# from my window tiling script:
set the bounds of the first window to {0, 22, (screenWidth / 2), screenHeight}
set position of the first window to {0, 22}
Awesome. Thanks for the tip.
Jesse