How to Automatically Eject All Disks on a Mac

It’s always been a pain to manually eject disks one by one before removing a MacBook from a dock. Here’s a way to use AppleScript to automate the process in just a few minutes.