Applescript will not enter password in Terminal

Having a strange problem here… I made a script to telnet into my server… this one works fine. I’m telnetting from OSX to Unix.

tell application "Terminal"
	do script "telnet 9000"
	delay 1
	do script "username" in window 1
	delay 1
	do script "password" in window 1
	delay 1
	do script "su" in window 1
	delay 1
	do script "password" in window 1
end tell

I need to make a script to start postfix when the machine starts up, but when I try to execute this script with the ‘quit’ command included, Terminal prompts to terminate the session. With the ‘quit’ command omitted, the terminal hangs at the password prompt.

tell application "Terminal"
	delay 1
	do script "sudo postfix start" in window 1
	delay 1
	do script "password" in window 1
end tell

Is this a security “feature” of OSX? If so, is there another way to enter text and a carriage return into the command line besides “do script”?

Other commonly known ways of getting postfix to start up automatically in 10.4 are not working, hence my attempt to do it this way.

Thanks in advance!

Browser: Firefox
Operating System: Mac OS X (10.4)

I’m not a master scripter by any means, but when I was trying to get sudo privileges someone on these boards told me to use:

with administratorprivileges

…after whatever command you want to be sudo’d.

Hope this works… :slight_smile:

oops, I was not planning on posting but some of these post are pretty rediculous.

What the hell are you using Terminal for.

That’s pretty ridiculous.

you should read over the manual when having trouble it says it right here how to do it

so it would be

tell application "Terminal"
	delay 1
	do script "echo PASSWORD | sudo -S postfix start" in window 1
end tell

That works perfectly. Much appreciated. Thanks. You rawk. :slight_smile:

You got a better idea? Let’s hear it.

I’m using Terminal because nothing else was working to get postfix to start when the computer boots.

Kel, this board is littered with your 1400+ comments - the majority of which are of you telling people to “experiment” and “read the manual”. Unless you have something constructive to contribute to the conversation, STFU.

Mods: You guys put up with this kind of stuff?

Admittedly, Kel was in a bad mood today and was not “nice” to two posters that I noted, but to say that

is hardly a fair representation of his contributions. I will say that he and others resent folks who expect other contributors to simply write a script for them, but that was not the case here.

Now to the technical issue: Assuming you’re running Tiger, this should work for you:

do shell script "postfix start" user name "yoursHere" password "yourPW" with administrator privileges

Save it as a run-only app so folks can’t easily see your PW, and set it to run at startup.

Sorry you were “pissed”.

ADDON: in 10.3.x, that should be (I think - don’t have it):

do shell script "sudo postfix start" user name "yoursHere" password "yourPW"

Yeah… I worked almost the entire day trying to get various things to work to solve my problem. Having failed at everything I tried, I posted a question here. I don’t expect others to do things for me - I’m not lazy. What is totally uncool is for someone like kel to treat me like some punk and spam the boards with insults. I looked at some other posts of his and noticed I’m not alone.

Thanks for your help Adam. I appreciate it.

here is the launchd way to start it

i’ve writen the file up for you and it should work. save it here

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">

if thats saved right then type in terminal

sudo launchctl load /Library/LaunchDaemons/com.postfix.custom.start.plist

I’t will now start at boot time with out any problem