------------------------------我是分割线------------------------------
on run {input, parameters}
do shell script "" with administrator privileges
set the rootPwd to text returned of (display dialog "请输入您的管理员密码:" default answer "" with hidden answer)
try
do shell script "echo " & rootPwd & "|sudo -S killall coreaudiod"
do shell script "echo " & rootPwd & "|sudo -S kextunload /System/Library/Extensions/AppleHDA.kext"
do shell script "echo " & rootPwd & "|sudo -S kextload /System/Library/Extensions/AppleHDA.kext"
do shell script "sudo -k" --logout root
display dialog "操作已经成功完成,您的系统应该能够恢复声音。
如果问题依旧,请直接重启系统。" buttons {"好"} with icon 1 with title "成功"
on error
display dialog "由于您输入错误的密码,操作无法进行。请再次运行这个服务,并重新输入正确的当前管理员密码。" buttons {"好"} with icon caution with title "错误"
end try
return input
end run
------------------------------我是分割线------------------------------