Totally new -- trying to be lazy -- need to create prompt

I got a cool terminal script from from Patrick Gibson which allows me to create/delete virtual host.

I keep forgetting the command line to run the program-- I use to have a memory of an elephant, but since motherhood dawned I have very little room in my brain for the small details. I have to keep opening the directions to get the 1 line of code it takes run the program.

Then I thought, why of course “Apple Script It”.

So that’s why I’m here.

I kinda know how to tell terminal the command line, but first I need apple script to prompt me for the vhost name then add that prompt to the command line text (“mysite”) so the text can be sent to the terminal.

Here’s the command line to send:


sudo /Users/userfolder/Web/bin/virtualhost.sh mysite

lunaC, I can’t test this – no vhost access here.

Fantastic.
Execept that it doesn’t let me answer the options of the script, like to create a folder or not. (It might be hard for you to imagine with out seeing the actual script)

The other odd thing is the reverse script doesn’t work-- privilages or not.


display dialog "What vHost should we use?" default answer "mysite"
set vHost to text returned of the result
do shell script "sudo /Users/userfolder/Web/bin/virtualhost.sh --delete" & vHost with administrator privileges

is there anyway to send the text, but have terminal open so I can run through the script there?

Sure,

tell application "Terminal"
    do script "sudo /Users/userfolder/Web/bin/virtualhost.sh"
end tell

That will open a new terminal session with the “sudo /Users/userfolder/Web/bin/virtualhost.sh” command executed. – again untested!

Perfect :smiley: