I\'m on Yosemite, and I want to toggle hide/show all the hidden files on a Mac.
Every-time, I want to do that I have to go to Terminal.app and run
Change "killall Finder" to "KillAll Finder" in user309603's script, save it as an applet somewhere, and it should work. That means that you can just write "ToggleVisible" or something in Spotlight, and it will do the changes.
I'd also wrap the alert box into a tell application (path to frontmost application as text) block, to ensure that it won't get lost.