Script for toggle show/hide hidden files on Mac
try
set state to (do shell script "defaults read com.apple.finder AppleShowAllFiles") as boolean
on error
set state to false
end try
do shell script "defaults write com.apple.finder AppleShowAllFiles " & (not state)
try
tell application "Finder"
set w to front window
set t to (get target of w)
if t is not startup disk then
set the target of w to startup disk
else
set the target of w to home
end if
set the target of w to t
end tell
end try
tell application (path to frontmost application as text)
display notification "ShowAllFiles is now " & (not state)
end tell
###Toggle show/hide hidden files on Mac