Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.6: A Service to show/hide hidden files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.6: A Service to show/hide hidden files
Authored by: paulw on Jul 20, '10 09:14:22AM
I use the following code for creating the service instead. This toggles between viewing hidden files or not, without calling osascript.

I can't find the original post on the internet where I acquired it, so credit to whoever posted it to begin with.

I set a keyboard shortcut (command-shift-'.') in the keyboard prefpane to activate the service.

SHOWHIDDEN=`defaults read com.apple.finder AppleShowAllFiles`
if [ $SHOWHIDDEN -eq 1 ]; then
defaults write com.apple.finder AppleShowAllFiles -bool FALSE
killall Finder
else
defaults write com.apple.finder AppleShowAllFiles -bool TRUE
killall Finder
fi
sleep 0.25
open /System/Library/CoreServices/Finder.app


[ Reply to This | # ]
10.6: A Service to show/hide hidden files
Authored by: mchagers on Jul 21, '10 01:46:52AM

When I tried this script in automator I got the error:
SHOWHIDDEN=1: Command not found
It worked when I changed the shell selection from the default /bin/tcsh to /bin/bash with the popup menu at the top of the Run Shell Scripts block.
Perhaps /bin/tcsh isn't always the default shell, but in my case it was, so this may help some other people as well.



[ Reply to This | # ]
10.6: A Service to show/hide hidden files
Authored by: mchagers on Jul 21, '10 02:06:33AM

Another thing: Killall Finder causes the Finder to forget the most recent changes to window positions.
using Applescript to quit the Finder ensures that your windows reappear exactly as before invoking the service.



[ Reply to This | # ]