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.

Use Applescript to run a terminal command


Thread Closed

 
Thread Tools
Turk182

 
Member Since: Jan 30, 2009
Posts: 48
Turk182 is an unknown at this point

Turk182 is offline
I have a Terminal command and associated password to execute the command (a command and a password) I must run dozens of times a day. Bored of doing it hand 1 by 1.

So, I started writing an Applescript (that I will turn into an Application so I can just click it to execute all in 1 click) that opens terminal, enters the command BUT the command is only executed if I enter the necessary password. but, that is where I am stuck. I can open terminal, have it enter the command, but I am not sure how to then follow-up with the password to execute the command when prompted. Here is what I have and it works perfect

tell application "Terminal"
activate
do script "blahblahblahblahblah" in front window
end tell


I have tried these variations, but no luck

do script "blahblahblahblahblah" password "passwordhere" in front window - as a means of entering script and the password in 1 shot
do script "passwordhere" in front window - as a means of then entering the password after first script runs

so, not sure how to get it to follow up the command at the password prompt that comes up and enter the password. Yes, I will keep working on it.. but if you can see the fix, please advise.
Turk182

 
Member Since: Jan 30, 2009
Posts: 48
Turk182 is an unknown at this point

Turk182 is offline
I was soooo close...

what I needed was

delay 1 -- pause for a second

after the first command and then execute the second password command do script "passwordhere" in front window

Thread Closed


« Help with PackageMaker needed | Hello World app takes 45s to start from the terminal, gcc, gdb and dtrace problems »
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
Hello World app takes 45s to start from the terminal, gcc, gdb and dtrace problems Ethan asdf OS X - Development and Darwin 5 02-12-2009 05:03 PM
copy command from terminal sgribber OS X - Operating System 0 06-08-2008 09:25 PM
Applescript vs Automator vs Unix Command Thyamine OS X - Development and Darwin 3 02-25-2008 10:23 PM
Terminal command question MACGIRL34 OS X - Operating System 1 12-12-2007 04:26 PM
looking for a terminal emulator and command shell in Mac OSX CandiMarie OS X - Operating System 9 03-05-2004 03:53 PM

All times are GMT -4. The time now is 07:52 PM.

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?