将以下代码复制到脚本编辑器中,可导出为应用程序使用
display dialog "隐藏/显示隐藏文件" buttons {"切换", "取消"} cancel button 2 with icon 2 with title "Show or hide all files"
set switch to button returned of result
if switch is "切换" then
do shell script "STATUS=`defaults read com.apple.finder AppleShowAllFiles`
if [ $STATUS == true ]
then
`defaults write com.apple.finder AppleShowAllFiles false`
else
`defaults write com.apple.finder AppleShowAllFiles true`
fi
`killall Finder`
"
end if