image
image

Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
Thread Tools
  #1  
Old February 20th, 2006, 06:49 PM
Registered User
 
Join Date: Feb 2006
Location: Northern VA
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jasonvp is on a distinguished road
Starting Terminal from CLI

Greetings -

I run OpenMenu so that I can get a pop-up menu when I right-click anywhere in the background. It allows me to start applications quickly and easily; very X11-ish. From that menu, I run scripts that pop open xterms that ssh to other hosts.

I'd like to use another terminal app, like the one included with OS X. I can't figure out how to open Terminal from the CLI. Is it possible? I know the 'open' command will do it, but it'll only open the first one. I need a way, from the CLI, to open new Terminal windows and automatically run commands within them.

Is it possible to do this?

Thanks!

jas
Reply With Quote
  #2  
Old February 21st, 2006, 12:59 PM
Fragger's Avatar
Lorem Ipsum
 
Join Date: Nov 2000
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Fragger is on a distinguished road
Smile a few ways

Jas,

You can open terminal by running the command (not surprisingly):

Code:
open /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
Your best bet: an apple script that contains the lines

Code:
tell application "Terminal"
	do script "command"
end tell
where "command" is something like "ps -aux | grep monkey". Also you can have this call a shell script, if that is more familiar to you. Just use the script editor or your favorite text editor to dream up whatever you want. You can run that applescript you created from CLI using:

Code:
osascript scriptname
Good luck,
Graham
__________________
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
Reply With Quote
  #3  
Old February 21st, 2006, 01:08 PM
Registered User
 
Join Date: Feb 2006
Location: Northern VA
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jasonvp is on a distinguished road
Graham -

Quote:
Originally Posted by Fragger
Jas,
You can open terminal by running the command (not surprisingly):
Won't this only open the *first* Terminal window? I've tried this a few times and it does nothing if I already have a Terminal window open. Perhaps there's an arg I can throw to open that says "Open *another* copy of this?"

Thanks!

jas
Reply With Quote
  #4  
Old February 21st, 2006, 01:13 PM
Fragger's Avatar
Lorem Ipsum
 
Join Date: Nov 2000
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Fragger is on a distinguished road
You are correct that would only open the first window, but the subsequent commands I gave you will open a new window for each time you run them. If you run
Code:
do script ""
as is, with nothing between the quotes, it will simply spawn a new window (ugly, yes.)

Hopefully the helps,
graham
__________________
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
Reply With Quote
  #5  
Old February 21st, 2006, 05:52 PM
Registered User
 
Join Date: Feb 2006
Location: Northern VA
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jasonvp is on a distinguished road
Quote:
Originally Posted by Fragger
You are correct that would only open the first window, but the subsequent commands I gave you will open a new window for each time you run them.
Way friggen cool. Thanks! Just what I was looking for.

jas
Reply With Quote
  #6  
Old February 22nd, 2006, 06:38 PM
Registered User
 
Join Date: Feb 2006
Location: Northern VA
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jasonvp is on a distinguished road
OK, follow-up question. I've whipped up a few AppleScripts to do exactly what I want, and they work great. Now: can I use the same scripts the set the title of each individual Terminal.app window?

For instance, I tried this in the script I use to just open a new Terminal (no command)
Code:
tell application "Terminal"
	do script ""
	set title of window to "test"
end tell
But it tells me it can't set the title of window to "test". I'm missing some other step or key here...

Thanks.

jas
Reply With Quote
Reply

Thread Tools

Posting 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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Starting up MLE Mac OS X System & Mac Software 1 December 1st, 2005 04:05 PM
Mac Not Starting zoombee101 Hardware & Peripherals 1 September 22nd, 2005 08:08 PM
Starting finder window from Terminal Ripcord Mac OS X System & Mac Software 2 June 22nd, 2003 06:57 PM
Starting off Paul C Software Programming & Web Scripting 4 February 2nd, 2003 12:17 AM
Just starting Androo Design & Media 7 January 7th, 2003 11:38 PM


All times are GMT -5. The time now is 05:20 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.