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: ChaChi on Apr 10, '03 06:50:34PM

Just thought I'd add a script that I wrote to do this a while back. I still use it all the time.

You'll want to save this script as a "Stay Open" Application (if you need help doing this, please feel free to ask for help). After you launch it, it will stay open until you tell it to quit. You quit it by clicking the button that's named (of all things) "Quit". Clicking on it's dock icon, after it has run, will "reopen" (or re-run) the script. Hopefully it's fairly straight forward once you try it out for the first time. Hope someone gets as much use out of this as I have. Here it is:

--Start Script
on run
try
set CurrentSetting to (do shell script "defaults read com.apple.finder AppleShowAllFiles")
on error
set CurrentSetting to "0"
end try
if CurrentSetting is "0" then
set theText to "Show invisibles?"
set thelist to {"Show & Idle", "Show & Quit", "Stay Idle"}
else
set theText to "Hide invisibles?"
set thelist to {"Hide & Idle", "Hide & Quit", "Stay Idle"}
end if
activate
set thechoice to (choose from list thelist with prompt theText default items (item 1 of thelist) cancel button name "Quit")
if thechoice is not false then
if thechoice is not in (item 3 of thelist) then
if "Show" is in (thechoice as string) then
set thesetting to "1"
else if "Hide" is in (thechoice as string) then
set thesetting to "0"
end if
do shell script "defaults write com.apple.finder AppleShowAllFiles " & thesetting
tell application "System Events"
if "Finder" is in name of processes then tell application "Finder" to quit
delay 1
end tell
launch application "Finder"
end if
if "Quit" is in (thechoice as string) then
quit
return
end if
hideme()
else
quit
end if
end run

on reopen
run
end reopen

on quit
continue quit
end quit

on hideme()
tell application "System Events" to set visible of processes whose frontmost is true to false
end hideme
--End Script



[ Reply to This | # ]