This particular script will allow you to just press Enter to obtain the opposite result of the current Hidden or not variable. eg. if the hidden files are invisible, then set the default button to "show hidden files" and vice-versa.
try
set yorn to (do shell script "defaults read com.apple.Finder AppleShowAllFiles")
on error
set yournans to 2
end try
if yorn is "FALSE" then
set yornans to 2
end if
if yorn is "TRUE" then
set yornans to 3
end if
display alert "Revealer" message "Would you like to show all hidden files or hide them?" buttons {"Cancel", "Show Hidden Files", "Hide Hidden Files"} default button yornans
set ShowOrHideButton to button returned of the result
if ShowOrHideButton is "Show Hidden Files" then
do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE"
do shell script "killall Finder"
end if
if ShowOrHideButton is "Hide Hidden Files" then
do shell script "defaults write com.apple.finder AppleShowAllFiles FALSE"
do shell script "killall Finder"
end if
if ShowOrHideButton is "Show Hidden Files" then
set endAlert to "All hidden files are now visible."
end if
if ShowOrHideButton is "Hide Hidden Files" then
set endAlert to "All hidden files are now invisible."
end if
if ShowOrHideButton is "Cancel" then
set endAlert to "Nothing was changed."
end if
display alert "Revealer" message "Completed Successfully! " & endAlert & ""