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


Click here to return to the 'An AppleScript to quickly show or hide hidden files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to quickly show or hide hidden files
Authored by: GaelicWizard on Nov 21, '03 05:33:47PM
Since everyone else has been posting their versions, iThought I'd post mine. :-)

Very simple script, sort-of canibalized from previous posts. :-)

Basically it checks the current state, then asks what you want the state to be. If you click the state that it already is, then nothing happens, otherwise the finder quits and then restarts. :-)

Here it is:
tell application "Finder"
	activate
	set previous to "NO"
	set previous to do shell script "defaults read com.apple.finder AppleShowAllFiles"
	display dialog "Show Hidden Files... " & previous buttons {"TURN ON", "TURN OFF"} default button 2
	copy the result as list to {buttonpressed}
	
	if previous is "ON" and the buttonpressed is "TURN OFF" then
		do shell script "defaults write com.apple.finder AppleShowAllFiles OFF"
		quit
	end if
	if previous is "OFF" and the buttonpressed is "TURN ON" then
		do shell script "defaults write com.apple.finder AppleShowAllFiles ON"
		quit
	end if
end tell

delay 1
tell application "Finder" to launch

---
Pell

[ Reply to This | # ]

An AppleScript to quickly show or hide hidden files
Authored by: gaston@mac.com on Dec 05, '03 04:38:20AM

I keep getting an error:

"2003-12-05 10:37:21.795 defaults[475]
The domain/default pair of (com.apple.finder, AppleShowAllFiles) does not exist"

What's going wrong?



[ Reply to This | # ]