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


Click here to return to the '10.4: Use Automator to toggle hidden Unix files' visibility' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Use Automator to toggle hidden Unix files' visibility
Authored by: echo on Aug 17, '05 03:59:30PM
I have been using my simplified version created from that 2003 hint, as an AppleScript in the menubar script menu. The funny thing is in subsequent OS versions, it worked sporadically, so I would need to sometimes run it multiple times for it to work, + I never perfected it. Since Tiger, the same script works flawlessly! It's debatable whether it's easier to access it from the menubar, where I have it inline with only 2 scripts, or by automator contextual menu, where you would find it in a submenu. Here is the script:

set OnOff to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if inOff= "OFF" or inOff= "NO" or inOff= "0" then
	set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles ON"
else
	set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles OFF"
end if
tell application "Finder" to quit
do shell script OnOffCommand
delay 1
tell application "Finder" to launch


[ Reply to This | # ]
10.4: Use Automator to toggle hidden Unix files' visibility
Authored by: fracai on Aug 18, '05 09:01:47AM

put the Finder quit bit after the do shell script

my bet is that sometimes the Finder quits and restarts before your defaults write command has finished. in this case the Finder would load with hidden files still hidden as the new setting hasn't been read yet. running the toggle script again would toggle the setting back to hidden and it would again be down to luck.

or just create two scripts for on and off. then you don't need to worry about this issue at all.

---
i am jack's amusing sig file



[ Reply to This | # ]
10.4: Use Automator to toggle hidden Unix files' visibility
Authored by: verlhum on Oct 16, '05 07:23:25AM

I beleive you meant to say:
[code]
set OnOff to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if OnOff= "OFF" or OnOff= "NO" or OnOff= "0" then
set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles ON"
else
set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles OFF"
end if
tell application "Finder" to quit
do shell script OnOffCommand
delay 1
tell application "Finder" to launch
[/code]

It threw me for a loop until I realized that inOff was supposed to be OnOff



[ Reply to This | # ]