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 > Developer Center > How do I script the terminal?

How do I script the terminal?
Thread Tools
Dedicated MacNNer
Join Date: Jul 1999
Location: Maynard, MA
Status: Offline
Reply With Quote
Jan 20, 2002, 08:43 PM
 
Hi Everyone,
I am a newbie at Applescript, have done some minimal C programming. I cannot seem to figure out how to get a command passed via applescript to the terminal? I have looked everywhere, and it looks like the 'do script'

do script: Run a UNIX shell script or command do script with command string -- data to be passed to the Terminal application as the command linecommand is what I want, but I cannot for the life of me figure out the syntax. Can anyone enlighten me, perhaps send me to a good source or whatever? Thanks for your time...
Bob Morel

"An argument isn't just saying 'No it isn't'!" "Yes it is!" "NO IT ISN'T!"
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 20, 2002, 09:38 PM
 
Originally posted by rlmorel:
<STRONG>Hi Everyone,
I am a newbie at Applescript, have done some minimal C programming. I cannot seem to figure out how to get a command passed via applescript to the terminal? I have looked everywhere, and it looks like the 'do script'

do script: Run a UNIX shell script or command do script with command string -- data to be passed to the Terminal application as the command linecommand is what I want, but I cannot for the life of me figure out the syntax. Can anyone enlighten me, perhaps send me to a good source or whatever? Thanks for your time...
Bob Morel</STRONG>
Well technically the answer to your question is:

tell application "Terminal" to do script "top"

But a better thing to do, imho, instead of having to launch the terminal is to: do shell script "top"
That will execute the command without launching any other apps.
     
   
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:45 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2