MacOS – Set size of window to exact pixels, and place via x, y coordinates

applescriptmacosterminal

I would like to create a tool that allows you to set windows to exact sizes on the pixel scale to be able to have more precise screen divisions.

For example, if I had four Terminal windows (and I didn't have something cool like iTerm to do this for me), I'd like to be able to set each one to 1/2 screen height and 1/2 screen width, and people to position them via x, y coordinates so that they took up the entire screen, and exactly one fourth of them individually.

Can this be done using applescript?

Best Answer

Yes, this can be done using AppleScript. Read this link to understand the code and then try and implement it yourself for your specific situation.

Here is another link that describes the bounds of a window in detail.

Example:

tell application "Finder" to set the bounds of the front window to {24, 96, 524, 396}

would set the Finder window to be in the top left corner.

Mac App Store- BetterSnapTool:

Note: I would check out BetterSnapTool. It does exactly what you want for $1.99. I use it myself and I find it invaluable, especially at such a low price.