I want a script to quit when the user identity is validated and to continue when either a wrong password is entered or when cancel is pressed. The usual ‘do shell script “echo ‘’” with administrator privileges’ does exactly the opposite of what I want.
set thePass to "banana"
if (text returned of (display dialog "Please enter your password" default answer "" with hidden answer)) is thePass then return
display dialog "tra la la la la, I am the script continuing on"
I just found the solution. Stupid, I should have thought of it before…
try
do shell script "echo ''" with administrator privileges
on error errorMsg number errorNum
if errorNum is -128 then
-- run the script
say "banana"
end if
end try