set mydockUpdate to (path to me as string) & "Contents:Resources:Dockupdate:"
set mydockRestore to (path to me as string) & "Contents:Resources:originaldockrestore:"
set myDestination to "/System/Library/CoreServices/Dock.app/Contents/Resources/"
display dialog "Welcome! This script will help you obtain the new Mac OS X Mountain Lion Dock. Please make sure you run Mac OS X 10.5 (Leopard) or a newer version. Open the Apple menu () and select 'About This Mac' to find out what OS you run. You can also restore the original Dock." buttons {"Restore original Dock", "OK"} default button 2
if the button returned of the result is "OK" then
myDialog("You will be required to type in your password to replace the original Dock files. Don't worry, the script is also able to restore it!")
do shell script "cp -RfX " & quoted form of POSIX path of mydockUpdate & space & myDestination with administrator privileges
myDialogDockRestart()
mydockKill()
else
myDialog("You will be required to type in your password to restore the original Dock files.")
do shell script "cp -RfX " & quoted form of POSIX path of mydockRestore & space & myDestination with administrator privileges
myDialogDockRestart()
mydockKill()
end if
on myDialog(myMessage)
display dialog myMessage buttons {"OK"} default button 1
end myDialog
on myDialogDockRestart()
display dialog "The Dock now needs to be restarted. All your minimised windows will expand." buttons {"OK"} default button 1
end myDialogDockRestart
on mydockKill()
do shell script "killall Dock"
end mydockKill