Editar: Esto ya no parece funcionar desde El Capitán. killall FinderParece ser la única manera ahora.
Este es mi método actual de El Capitan, que también debería funcionar para Mountain Lion y mayores
set newHiddenVisiblesState to "YES"
try
set oldHiddenVisiblesState to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if oldHiddenVisiblesState is in {"1", "YES"} then
set newHiddenVisiblesState to "NO"
end if
end try
do shell script "defaults write com.apple.finder AppleShowAllFiles " & newHiddenVisiblesState & "; killall Finder"
Para Mavericks y Yosemite ...
No necesita reiniciar el Finder, solo actualice las ventanas.
Este Applescript cambiará el estado y se actualizará ...
set newHiddenVisiblesState to "YES"
try
set oldHiddenVisiblesState to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if oldHiddenVisiblesState is in {"1", "YES"} then
set newHiddenVisiblesState to "NO"
end if
end try
do shell script "defaults write com.apple.finder AppleShowAllFiles " & newHiddenVisiblesState
tell application "Finder"
set theWindows to every Finder window
repeat with i from 1 to number of items in theWindows
set this_item to item i of theWindows
set theView to current view of this_item
if theView is list view then
set current view of this_item to icon view
else
set current view of this_item to list view
end if
set current view of this_item to theView
end repeat
end tell
Crédito a ganbustein por la rutina mejorada de ocultar / mostrar
tell application "System Events"bloque alrededor de los dosdo shell script ...comandos. De hecho, me sorprende que System Events le permita decirle que invoquedo shell script.