Last active
November 20, 2015 15:55
-
-
Save yuanyan/11165846 to your computer and use it in GitHub Desktop.
fixaudio.applescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment