Quick Apple Script Question

Joined
Jun 10, 2005
Messages
237
Reaction score
7
Points
18
Location
Indiana; there's more than just corn here
Your Mac's Specs
Powerbook G4 1.67 MHz
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?
 
Joined
Dec 28, 2004
Messages
643
Reaction score
5
Points
18
Location
Albany, CA
Your Mac's Specs
ibook G4 12 inch running mac os 10.4 with: 60 gb HD+256 mb ram+Radeon 9200
You don't even need to open terminal:

do shell script "command for terminal here"

then if you want the result displayed in a window:

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...
 
Joined
Dec 28, 2004
Messages
643
Reaction score
5
Points
18
Location
Albany, CA
Your Mac's Specs
ibook G4 12 inch running mac os 10.4 with: 60 gb HD+256 mb ram+Radeon 9200
All right there we go it enters it and displays it in terminal:

tell application "Terminal"
do script "command for terminal here"
end tell
 
Joined
Aug 27, 2005
Messages
2,406
Reaction score
210
Points
63
Location
Fayetteville, AR
Your Mac's Specs
15" Powerbook G4 • 24" iMac • iPhone 3Gs
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.
 
Joined
Dec 28, 2004
Messages
643
Reaction score
5
Points
18
Location
Albany, CA
Your Mac's Specs
ibook G4 12 inch running mac os 10.4 with: 60 gb HD+256 mb ram+Radeon 9200
probably depends what type of command your using I tested that on the uptime command and it worked great.
 
OP
ezhangin
Joined
Jun 10, 2005
Messages
237
Reaction score
7
Points
18
Location
Indiana; there's more than just corn here
Your Mac's Specs
Powerbook G4 1.67 MHz
I want to run a python script inside of a terminal window
 
Joined
Dec 28, 2004
Messages
643
Reaction score
5
Points
18
Location
Albany, CA
Your Mac's Specs
ibook G4 12 inch running mac os 10.4 with: 60 gb HD+256 mb ram+Radeon 9200
o can't help ya there I have no experience in python.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top