user3767622 user3767622 - 4 months ago 31
AppleScript Question

sudo an application asking the user with a dialog?

I'd like to run an OSX application with admin privileges, so the user would be asked first for his admin log/pass.
Is there a bash command or an applescript command that would allow me to do that ?

Sort of a sudo command but with a graphic dialog shown to the user, similar to what the Finder shows when asking permission to write files in restricted folders.

thanks !


(if by OSX application are you talking about the applescript one?)

In applescript, you can display a dialog that finder displays for the users login and password but this will not tell you the password, it will basically run a shell script as sudo:

do shell script "myadminshellcommand arguments" with administrator privileges

By adding "with administrator privileges" you are telling AppleScript to run a shell script in sudo with the users password

(Don't add sudo to the command)