Do shell applescript

Hey hi…

What I wanna do seems pretty basic to me…
But since I’m a scripting nono, this is where I come for sum help…

I wanna make a small application to add users to a .htpasswd database.

I know the shell command for that is:


    htpasswd  /Library/WebServer/.htpasswd usernamehere

then u would get a return like:


     New password: 
     Re-type new password: 
     Adding password for user usernamehere

Now I can imagine the app would first ask u to fill in one variable (username)
and then prompt u to fill in the password twice.

Can anybody here get me started on this little app?

Tia
Immo

It might not work. This is from an Apple Technotes page…

http://developer.apple.com/technotes/tn2002/tn2065.html

Q: How do I control an interactive tool like ftp or telnet with do shell script?
A: The short answer is that you don’t. do shell script is designed to start the command and then let it run with no interaction until it completes, much like the backquote operator in most Unix shells or the system call in awk and Perl.

However, there are ways around this. You can script Terminal and send a series of commands to the same window (though this only works in Mac OS X 10.2 and later), or you could use a Unix package designed for scripting interactive tools, such as expect. Also, many interactive commands have non-interactive equivalents. For example, curl can substitute for ftp in most cases.

To do this you actually need to tell the application Terminal to do new window with a given command. (I can post the code once I get home…I have a script that when run from the finder opens a terminal window at the given folder.)