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}
Sometimes when telling an application to set the bounds doesn't work, telling System Events to change the position and size properties does:
tell application "System Events" to tell process "Live"
set position of window 1 to {0, 50}
set size of window 1 to {600, 650}
end tell
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}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With