Show/Hide hidden files in Finder

Discussion in 'OT Technology' started by JCrev, Aug 15, 2008.

  1. JCrev

    JCrev Where is your god now? OT Supporter

    Joined:
    Jul 18, 2004
    Messages:
    3,852
    Likes Received:
    11
    Location:
    Montreal, Quebec
    The last couple of weeks i've been working a lot with hidden files and found the regular way toggling between showing and not showing them to be annoying because it has to close all your finder windows. So I wrote an applescript that remembers all the finder windows you have open and reopens them after it changes the value.

    Here is a link to a compiled script (all you have to do is click on it to run it) and a copy of the source code.

    http://dl.getdropbox.com/u/31980/forums/showhide.zip
    Code:
    tell application "Finder"
    	set numWindows to count of windows
    	set increment to 1
    	set myLocation to {"placeholder", "placeholder", "placeholder", "placeholder", "placeholder", "placeholder", "placeholder", "placeholder", "placeholder", "placeholder"}
    	repeat numWindows times
    		set newLocation to folder of window increment
    		set item increment of myLocation to newLocation
    		set increment to increment + 1
    	end repeat
    end tell
    
    
    set switch to do shell script "defaults read com.apple.finder AppleShowAllFiles"
    if switch = "false" then
    	do shell script " defaults write com.apple.finder AppleShowAllFiles true&&killall Finder"
    end if
    if switch = "true" then
    	do shell script " defaults write com.apple.finder AppleShowAllFiles false&&killall Finder"
    end if
    delay 1
    
    tell application "Finder"
    	activate
    	set increment to 1
    	repeat numWindows times
    		tell item increment of myLocation
    			open
    			set increment to increment + 1
    		end tell
    	end repeat
    end tell
    
    
     
    Last edited: Aug 15, 2008
  2. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    working with hidden files or just downloading more porn?
     

Share This Page