-- Relevant post here: http://n8henrie.com/2012/08/show-or-hide-hidden-files-on-your-mac-with-applescript/
set question to display dialog "Show or hide hidden files?" & return & "Don\'t that forget this will relaunch Finder." buttons {"Show hidden files", "Hide hidden files", "Cancel"}
set theAnswer to button returned of result
if theAnswer is "Show hidden files" then
do shell script "defaults write com.apple.Finder AppleShowAllFiles TRUE && killall Finder"
end if
if theAnswer is "Hide hidden files" then
do shell script "defaults write com.apple.Finder AppleShowAllFiles FALSE && killall Finder"
end if
if theAnswer is "Cancel" then
return
end if