How do you catch the result of a user entering an invalid password three times in the administrator box, so I can shut down the script? Also, if the user hits cancel on the administrative dialog box, it should end the script as well. But I can’t use “button returned of” in this instance…I already tried.
--when something fails... for instance:
tell application "Finder"
open file "Foo" of the desktop
--then show the specific error and message...
on error errorMsg number errorNum
display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
do shell script "rm -r ~/Desktop/qwertzuio" with administrator privileges
on error number n
if n is -128 then
display dialog "User cancelled"
else if n = 1 then
display dialog "File doesn't exist"
display dialog "Dismissed"
The rm utility exits 0 if all of the named files or file hierarchies were
removed, or if the -f option was specified and all of the existing files
or file hierarchies were removed. If an error occurs, rm exits with a