2

I am using this command to do some magic for my personal use:

osascript -e \'tell application "Terminal" to do script

Is it possible to precisely define the width and height of the popup Terminal window?

If not, is there anyway I can do it after it's opened? (Precisely adjust its size value)

4

Open a Terminal window and position it on the screen where you want it and resize it to the size you want.

Then in Terminal, execute the following command:

osascript -e 'tell application "Terminal" to get bounds of front window'

It will return a four-item list of integers, e.g:

0, 22, 730, 531

Now move the Terminal window to a different position on the screen and resize it.

Then in Terminal, execute the following command, while substituting the actual list returned from the get bounds command, e.g:

osascript -e 'tell application "Terminal" to set bounds of front window to {0, 22, 730, 531}'

You'll see that the window gets repositioned and resized to what it was when you ran the get bounds command.

  • Thanks for your answer! Is it possible to resize any other Application in this way? (For example, a Safari window) – AGamePlayer Dec 28 '16 at 1:44
  • @Aw Qirui Guo, Yes, just substitute the applications name, e.g. osascript -e 'tell application "Safari" to set bounds of front window to {0, 22, 730, 531}' – user3439894 Dec 28 '16 at 2:29

Not the answer you're looking for? Browse other questions tagged .