How to rename osascript in the administrator privileges dialog

applescriptterminal

I have used the command.

/usr/bin/osascript -e 'do shell script "echo hello args 2>&1 etc" with administrator privileges'

It asks for password saying osascript want to make changes. What I want is, how do I change the word osascript?

Best Answer

I found a much better way of doing this, by digging through the Applescript doc on the Apple Developer's Site. I found this release note for Applescript in MacOS 10.10

It says:

do shell script can now specify a custom prompt to use in the password dialog. [15194980]

However, it neglects to say how you can do that. After some guesswork, I figured out that there's a prompt clause that lets you replace osascript wants to make changes... with whatever you want when using do shell script...with administrator privileges in a script invoked by osascript. For example:

osascript -e 'do shell script "ls -l" with prompt "The Great And Powerful OZ " with administrator privileges'

generates a dialog box that looks like: enter image description here

I hope this helps someone.