Skip to content

Instantly share code, notes, and snippets.

@LarsEliasNielsen
Created January 23, 2014 15:20
Show Gist options
  • Save LarsEliasNielsen/8580310 to your computer and use it in GitHub Desktop.
Save LarsEliasNielsen/8580310 to your computer and use it in GitHub Desktop.
AppleScript to stop current backup, eject Timemachine disk. My Timemachine disk has another partition, so this is ejected also. Notofications is displayed when disks are ready to be disconnected.
-- Stops current backup do shell script "/Applications/'Time Machine.app'/Contents/MacOS/'Time Machine' 3" -- Set disk names set wd to "WD" set timemachine to "TIMEMACHINE" -- Eject WD tell application "Finder" if disk wd exists then eject disk wd display notification "WD disk has successfully been ejected" with title "WD ejected" else display notification "WD disk was not mounted" with title "WD not mounted" end if end tell -- Eject TIMEMACHINE tell application "Finder" if disk timemachine exists then eject disk timemachine display notification "TIMEMACHINE disk has successfully been ejected" with title "TIMEMACHINE ejected" else display notification "TIMEMACHINE disk was not mounted" with title "TIMEMACHINE not mounted" end if end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment