Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > open & arrange terminal windows via applescript?

open & arrange terminal windows via applescript?
Thread Tools
dr. zoidberg
Mac Enthusiast
Join Date: Aug 2001
Location: planet express
Status: Offline
Reply With Quote
May 7, 2002, 11:25 AM
 
folks... i know it�s a bad time to ask about anything else that quartz extreme and brushed metal, but since there is no way to arrange windows in the terminal (or basically in os x, for that matter) *automatically*, i�ve asked myself if you can write an appleskript which does the following:

- launch terminal.app
- open two windows (respectively or a second window) at certain size (eg. 30 rows 180 cols)
- arrange them so that they don�t overlap (what�s it called... tile?)

the idea is to have multiple terminal-windows opening up at one click without them overlapping.

probably it�s pretty easy, but i don�t know heck about appleskript yet... any ideas?
"And Zapp Brannigan, your score qualifies you as assistant delivery boy, second class."
"Hmm. I guess I'll have to sleep my way to the top. Kif, wake me when I'm there."
     
dr. zoidberg  (op)
Mac Enthusiast
Join Date: Aug 2001
Location: planet express
Status: Offline
Reply With Quote
May 7, 2002, 03:51 PM
 
hehe... now that someone took a heart and closed all the superflous quartz-threads... *bump*

"And Zapp Brannigan, your score qualifies you as assistant delivery boy, second class."
"Hmm. I guess I'll have to sleep my way to the top. Kif, wake me when I'm there."
     
sjk
Forum Regular
Join Date: Feb 2002
Location: Hawaii
Status: Offline
Reply With Quote
May 8, 2002, 04:03 PM
 
Not sure you can do it with AppleScript (I'm slow to learn it), but you can use .term files to open windows with the layout and other attributes you want. Easiest way to do that is set up windows as you like, then use the "Shell->Save As" menu item to create the .term file. Select "Open this file when Terminal starts up" and "What to save" to "All windows" if you want those options. Any .term files you save will be available under the "Shell->Library" menu, or you can double-click the icon to launch it, or use "open path-to-file.term"... and other clever ideas. The .term file is in XML format so you can have a look at it if you're curious. Oh, saving .term files in ~/Library/Application Support/Terminal is a recommended location.

Hope that helps. Now, back to this week's QE and BM threads...
     
Mithras
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
May 8, 2002, 04:20 PM
 
Terminal's Applescript functionality is somewhat broken, and will not let you set the location of new windows.

Apart from that, you can open new windows simply with

<font face = "courier">
tell application "Terminal"
activate
repeat with i from 1 to 2
do script with command ""
set number of rows of (window i) to 80
set number of columns of (window i) to 132
end repeat
end tell
</font>
     
sjk
Forum Regular
Join Date: Feb 2002
Location: Hawaii
Status: Offline
Reply With Quote
May 8, 2002, 05:23 PM
 
Thanks for the example... I now see what I was missing trying to make that work earlier.
     
dr. zoidberg  (op)
Mac Enthusiast
Join Date: Aug 2001
Location: planet express
Status: Offline
Reply With Quote
May 9, 2002, 11:10 AM
 
yay.... worked perfectly with "save as.... .term"

thanks a lot!!!
"And Zapp Brannigan, your score qualifies you as assistant delivery boy, second class."
"Hmm. I guess I'll have to sleep my way to the top. Kif, wake me when I'm there."
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:06 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,