New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Quick Apple Script Question


Post Reply New Thread Subscribe

 
Thread Tools
ezhangin

 
ezhangin's Avatar
 
Member Since: Jun 10, 2005
Location: Indiana; there's more than just corn here
Posts: 237
ezhangin has a spectacular aura about
Mac Specs: Powerbook G4 1.67 MHz

ezhangin is offline
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?
QUOTE Thanks
johninc

 
johninc's Avatar
 
Member Since: Dec 28, 2004
Location: Albany, CA
Posts: 643
johninc is on a distinguished road
Mac Specs: ibook G4 12 inch running mac os 10.4 with: 60 gb HD+256 mb ram+Radeon 9200

johninc is offline
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...
QUOTE Thanks
johninc

 
johninc's Avatar
 
Member Since: Dec 28, 2004
Location: Albany, CA
Posts: 643
johninc is on a distinguished road
Mac Specs: ibook G4 12 inch running mac os 10.4 with: 60 gb HD+256 mb ram+Radeon 9200

johninc is offline
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
QUOTE Thanks
surfwax95

 
surfwax95's Avatar
 
Member Since: Aug 27, 2005
Location: Fayetteville, AR
Posts: 2,410
surfwax95 has much to be proud ofsurfwax95 has much to be proud ofsurfwax95 has much to be proud ofsurfwax95 has much to be proud ofsurfwax95 has much to be proud ofsurfwax95 has much to be proud ofsurfwax95 has much to be proud ofsurfwax95 has much to be proud ofsurfwax95 has much to be proud of
Mac Specs: 15" Powerbook G4 24" iMac iPhone 3Gs

surfwax95 is offline
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.

I try to Command+Shift+/ when I can.
They're - Their - There | Two - Too - To | You're - Your | MAC - Mac
I was on the M-F honor roll for October, 2006.
QUOTE Thanks
johninc

 
johninc's Avatar
 
Member Since: Dec 28, 2004
Location: Albany, CA
Posts: 643
johninc is on a distinguished road
Mac Specs: ibook G4 12 inch running mac os 10.4 with: 60 gb HD+256 mb ram+Radeon 9200

johninc is offline
probably depends what type of command your using I tested that on the uptime command and it worked great.
QUOTE Thanks
ezhangin

 
ezhangin's Avatar
 
Member Since: Jun 10, 2005
Location: Indiana; there's more than just corn here
Posts: 237
ezhangin has a spectacular aura about
Mac Specs: Powerbook G4 1.67 MHz

ezhangin is offline
I want to run a python script inside of a terminal window
QUOTE Thanks
johninc

 
johninc's Avatar
 
Member Since: Dec 28, 2004
Location: Albany, CA
Posts: 643
johninc is on a distinguished road
Mac Specs: ibook G4 12 inch running mac os 10.4 with: 60 gb HD+256 mb ram+Radeon 9200

johninc is offline
o can't help ya there I have no experience in python.
QUOTE Thanks

Post Reply New Thread Subscribe


« Editing the path | changing directory permission problem »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
[How To] Macintosh Keyboard Short Cuts hype.it Switcher Hangout 25 06-09-2009 09:53 PM
Quick Question Bradstreet Images, Graphic Design, and Digital Photography 4 12-23-2005 09:34 AM
News: Rival of Apple, Armed With Fresh Patent crazycanadian Apple Rumors and Reports 2 08-31-2005 03:18 PM
Quick question fellow iBookers' ByzantineRemnant Apple Notebooks 9 03-06-2005 01:21 AM
Question about Apple laptops arkman_1411 Apple Notebooks 5 07-26-2004 04:44 PM

All times are GMT -4. The time now is 10:11 AM.

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

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?