How to get the dimensions of the dock with AppleScript in Mac OS X Leopard

This code snippet might be useful for anyone wanting to write a script to resize your application windows automatically to fit on your display.

tell application "System Events" to tell process "Dock"
    set dock_dimensions to size in list 1
    set dock_width to item 1 of dock_dimensions
    set dock_height to item 2 of dock_dimensions
end tell

Note: I'm fairly sure you need to enable UI scripting for this to work.

Comments

blog comments powered by Disqus