Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I created a Service with Automator on a Mac running "Lion 10.7.3". The Service toggles via a shell script the visibility of hidden files in the Finder and works like a charm. Here's the script:

STATUS=`defaults read com.apple.finder AppleShowAllFiles`
if [ $STATUS == YES ]; 
then
    defaults write com.apple.finder AppleShowAllFiles NO
else
    defaults write com.apple.finder AppleShowAllFiles YES
fi
killall Finder

Because this script was doing so nice, I thought I could do a similar script that toggles the key closeViewZoomFollowsFocus between the values TRUE and FALSE. So I did another script:

STATUS=`defaults read com.apple.universalaccess closeViewZoomFollowsFocus`
if [ $STATUS == TRUE ]; 
then
    defaults write com.apple.universalaccess closeViewZoomFollowsFocus FALSE
else
    defaults write com.apple.universalaccess closeViewZoomFollowsFocus TRUE
fi

The problem with this script is that the change takes no effect. To be precise: The script changes the value as it should, I checked it in the Terminal with defaults read com.apple.universalaccess closeViewZoomFollowsFocus. But the change is not activated.

In my original script that toggles the hidden files I solved this with killal Finder. Unfortunately I have no idea how to achieve an instant activation of the changed default in my second script.

When you change the same default via the System Preferences, it does take effect instantly without logoff/logon or anything else. So I wonder about a command that activates such a change instantly in the background. Any ideas?

share|improve this question
    
Feel free to include links to the screenshots and we can embed them for you. –  Nathan Greenstein Feb 26 '12 at 19:33
    
Thank you - it's no longer relevant. –  Universal Feb 26 '12 at 22:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.