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: smccandlish on Sep 20, '11 10:12:36PM

Better yet, use

sleep 5

between the commands to quit and activate the finder. If you try to do it with a pause in Automator, it may fail to restart the Finder when the service is run from Finder itself but the sleep method gets around this problem. My automator script to do this is:

Service receives: No input
in: Any application

Run Shell Script (Shell: /bin/bash):

SHOW=`defaults read com.apple.finder AppleShowAllFiles`
if [ "${SHOW}x" = "1x" ]; then
   defaults write com.apple.finder AppleShowAllFiles -bool FALSE
else
   defaults write com.apple.finder AppleShowAllFiles -bool TRUE
fi

Ask for Confirmation:

Restart Finder?
Make sure no copy or move operations are in progress.

Run Shell Script (Shell: /bin/bash):

osascript -e 'tell application "Finder" to quit';
sleep 1
osascript -e 'tell application "Finder" to activate';

Works like a charm.

---
Stanton McCandlish
Principal, McCandlish Consulting


[ Reply to This | # ]