|
|
Beat me to the punch
This only works once the preference is once set. So it is needed
to at least once type "
defaults write com.apple.finder
AppleShowAllFiles ON" in the Terminal (or set it with
TinkerTool,
or any other utility that does this...)
Another way
Just a thought, but you can get around problems with quitting and launching the finder mid-script by setting the default the killing the finder:
!!! THIS IS THE MOST ELEGANT CODE !!!
DanCleaver (above) posted the simple (elegant) answer, but I also liked the idea of a "Cancel" button mentioned by one of the other posters.
Following the general rule of Least Harmful by Default...
display dialog "¿ Show Hidden Files ?" buttons {"Yes", "No", "Cancel"} default button 3
copy the result as list to {buttonpressed}
try
if the buttonpressed is "Cancel" then quit
if the buttonpressed is "No" then do shell script ¬
"defaults write com.apple.finder AppleShowAllFiles OFF"
if the buttonpressed is "Yes" then do shell script ¬
"defaults write com.apple.finder AppleShowAllFiles ON"
end try
do shell script "killall Finder"
Thanx DanCleaver.
!!! OF COURSE YOU COULD COMBINE !!!
the second if statement of the try thus...
if the buttonpressed is "No" then do shell script ¬ "defaults write com.apple.finder AppleShowAllFiles OFF" else do shell script ¬ "defaults write com.apple.finder AppleShowAllFiles ON" end if |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.10 seconds |
|