Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   Quick Apple Script Question (http://www.mac-forums.com/forums/os-x-development-darwin/27725-quick-apple-script-question.html)

ezhangin 12-13-2005 11:10 PM

Quick Apple Script Question
 
How would I enter a line of text into terminal via an apple script? I got the script to open terminal, i need the script to then enter one line of text into terminal, and then it opens another application (which also works). So basically I can't figure out how to just enter text into terminal through an apple script. Anyone know?

johninc 12-13-2005 11:25 PM

You don't even need to open terminal:

Quote:

do shell script "command for terminal here"
then if you want the result displayed in a window:

Quote:

do shell script "command for terminal here"
display dialog "" & result & ""

oops just realized you wanted to enter text into terminal.... Give me a minute for that...

johninc 12-13-2005 11:29 PM

All right there we go it enters it and displays it in terminal:

Quote:

tell application "Terminal"
do script "command for terminal here"
end tell

surfwax95 12-14-2005 12:27 AM

I was looking for this same answer, but the script mentioned gets an error: "Terminal couldn't complete the operation because it is not connected."

I just tried a "top" command.

johninc 12-14-2005 12:43 AM

probably depends what type of command your using I tested that on the uptime command and it worked great.

ezhangin 12-14-2005 01:56 AM

I want to run a python script inside of a terminal window

johninc 12-14-2005 09:30 PM

o can't help ya there I have no experience in python.


All times are GMT -4. The time now is 03:45 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.