Applescript - bounds etc..
Hi,
I'm trying to make a script that will resize a window to a particular aspect ratio.
a bit of info/requirements:
-when printing from this particular app, the entire window (excluding toolbars) is considered.. if i want to print USletter and the current window is set at something other that 11:8.5, the print will be letterboxed(?) accordingling (ie- whatever size the drawing window is will be best fit to the page leaving blank spaces on the sides or top/bottom).. i'd like to be able to set the window to a size matching my paper so the entire window fills the paper
-i need to get the bounds of the window -- excluding the toolbar.. just the drawing area (graphics app)
-i would like the window to be resized so the longest side fills the screen (ie- if portrait USletter, the window will use all available space from the top to bottom of the display.. excluding the dock (if the user has one at the bottom), the menu bar (as far as i can gather, it's 22px for all users?), and toolbars in the app itself.. (the problem with the toolbar is that some people will have small icons, some large, some with text etc.. so it's height is different depending on the users preferences.. this is why i need dimensions of what space is left in the window without considering the toolbars)
-some things i already can do -- get the overall display size, resize the window, do the aspect ratio calculations according to desired paper size (in other words, i can make the script work properly on my machine.. i know the environment, my dock placement, my toolbar size, etc.. i'd like to be able to make it work on other people's machines with different dock placement and toolbar settings)
....
so i guess what i'm asking is:
how can i --
get or set the bounds of the working space of a window (the part without the toolbar) and/or determine the size of a user's toolbar so i can add that in my calculations?
determine where the dock is and how big it is (i keep my dock on the side so it doesn't really matter.. most people seem to keep theirs at the bottom so it does matter
i'm sure i left some stuff out but i'll provide more info / clarify upon request.
thanks
jeff
2.66 quad mac pro/ 15"i7mbp-OTHER, Mac OS X (10.7.2)