Need some help here!

Hi, I am trying to create a dialog box that has 3 buttons that will run pre-made shell scripts. Where I am running into the problem is that I need sudo privileges to some of the commands being run. I do not want to build the password into the script since it will vary on each machine. What I would like is perhaps a popup dialog box that asks for the password and then is used in the scripts when they are executed. If you see any other ways of making the script run better I am open to it. Any help is appreciated I have attached what I have thus far. Thanks in advance…

display dialog “” buttons {“Install”, “Remove”, “Restore”}

if the button returned of the result is “Install” then

do shell script "sudo sh /Applications/App.app/Contents/Resources/Scripts/.install/install.sh"

end if
if the button returned of the result is “Remove” then

do shell script "sudo sh /Applications/App.app/Contents/Resources/Scripts/.install/remove.sh"

end if

if the button returned of the result is “Restore” then

do shell script "sudo sh /Applications/App.app/Contents/Resources/Scripts/.install/restore.sh"

end if

Thanks…

Hi,

easiest version


set {button returned:b} to display dialog "" buttons {"install", "remove", "restore"}
do shell script "sh /Applications/App.app/Contents/Resources/Scripts/.install/" & b & ".sh" with administrator privileges

Awesome… Worked perfectly thank you.