Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ZestyOne

macrumors regular
Original poster
Oct 18, 2009
113
68
Paradise
I used to use this shell script to toggle hidden files without having to restart finder with killall.

Unfortunately now when I run the script via hotkey nothing happens. If I force restart finder it will load, but that defeats the purpose of doing the toggle in realtime without restarting.

Code:
set newHiddenVisiblesState to "YES"
try
    set oldHiddenVisiblesState to do shell script "defaults read com.apple.finder AppleShowAllFiles"
    if oldHiddenVisiblesState is in {"1", "YES"} then
        set newHiddenVisiblesState to "NO"
    end if
end try
do shell script "defaults write com.apple.finder AppleShowAllFiles " & newHiddenVisiblesState


tell application "Finder"
    set theWindows to every Finder window
    repeat with i from 1 to number of items in theWindows
        set this_item to item i of theWindows
        set theView to current view of this_item
        if theView is list view then
            set current view of this_item to icon view
        else
            set current view of this_item to list view

        end if
        set current view of this_item to theView
    end repeat
end tell
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.