1

I want to change the height of my terminal window using a script. Currently this is what I have come up with:

tell application "iTerm"
activate

    tell the current terminal       
        tell the current session
            set number of rows to 30
        end tell
    end tell
end tell

And I keep on getting this error:

Can't set number of rows of current session of current terminal to 30.

Furthermore, what I would like to do is, have a script that will simply increment the row size by 1. Any help is greatly appreciated.

EDIT

I checked the AppleScript dictionary, and it turns out, number of rows is a property for a 'terminal', not a 'session', so I tried this code:

tell application "iTerm"
activate

    tell the current terminal
        set number of rows to 30
    end tell
end tell

And I am getting this error now:

iTerm got an error: Can't set current terminal to 30.

There isn't even a mention of the row size anymore. It is trying to set the 'terminal' to 30??

1 Answer 1

0

The following worked for me. Similar examples are also posted on the Google Code wiki for iTerm2.

tell application "iTerm"
    tell the current terminal
        set number of rows to 30
    end tell
end tell

The error you're getting seems weird enough, but the syntax is correct. Try restarting AppleScript Editor and iTerm2. You could also try assigning a new terminal like set newterm to (make new terminal), and then tell newterm to set number of rows to 30 or similar.

You must log in to answer this question.

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