I like how simple the eject all disks code can be:
try
tell application "Finder"
eject the disks
end try
I would love it if there was a way to add an exception to the list instead of having to manually list all the drives I do want to eject. Specifically, I'm looking for a way to eject all external drives except for my time machine drive. Is there a way to add an applescript exception to the code to allow this?
I checked it out but doesn't quite offer the functionality that I want. I want to always leave a specific drive mounted and mount all other drives which that doesn't help me with. The name of the drive will be the same every time, I just figured someone who knew applescript would be able to tell me how to add an exception to it.
You can control Jettison based on your conditions on mounting or unmounting using AppleScript with System Events …
If you put your Mac to sleep Jettison will unmount the drives for you and remount them on wake - maybe I am wrong here but I think there is a possibility that only the ones you’ve had mounted before sleepmode will get mounted again after wake and not the others that you don’t need … but even that is not the case … use AppleScript to unmount the ones you don’t need or change the behavior completely or even to other drives …
My friend told me that Jettison has AppleScript support so you could talk directly to the Application using these 4 commands:
tell application "Jettison" to Mount <DriveName>
tell application "Jettison" to Eject <DriveName>
tell application "Jettison" to EjectAndSleep
tell application "Jettison" to Sleep
the Mount command mounts all previously ejected drives or the ones you define
the Eject command ejects all drives or the ones you define
the EjectAndSleep command ejects all drives and puts the Mac directly to sleep
the Sleep command puts the Mac to sleep
Using these commands you can also have the full control over diskimages (dmg) and sd cards if you want - for this to work you have to enable the corresponding Settings…
This application is a game changer no more unnecessary unplugging and replugging for drives or the usage of diskutil to mount a drive …