Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###########################################################
- # ABOUT
- ###########################################################
- (*
- Phil Stokes -- 2016
- applehelpwriter.com
- sqwarq.com
- *)
- ###########################################################
- # DESCRIPTION
- ###########################################################
- (*
- Choose which disks to eject, specify a group, and/or all from a list
- *)
- ###########################################################
- # USAGE
- ###########################################################
- (*
- Run the script and make a selection to eject.
- *)
- ###########################################################
- # IMPORT STATEMENTS
- ###########################################################
- use AppleScript version "2.4" -- Yosemite (10.10) or later
- use scripting additions
- ###########################################################
- # VARIABLES
- ###########################################################
- set collection_1 to {}
- set diskList to {"All Disks"}
- --if you want to add a choice that groups some volumes together uncomment the following two lines:
- # set collection_1 to {"One vol", "Another vol", "Some other vol", "and so on vol"} -- supply the volunem names you want to group together here
- # set diskList to {"All Disks", "Disk Group 1"}
- ###########################################################
- # COMMANDS
- ###########################################################
- tell application "Finder"
- try
- set diskList to diskList & (name of every disk whose ejectable is true)
- on error
- display dialog "No Disks are currently mounted" buttons {"OK"} default button "OK" with icon 1
- end try
- end tell
- if (count of diskList) is greater than 1 then
- set theDisk to choose from list diskList with prompt "Select disks to eject:"
- try
- tell application "Finder"
- if theDisk's item 1 is "All Disks" then
- eject every disk
- else if theDisk's item 1 is "Disk Group 1" then
- repeat with i from 1 to count of items in my collection_1
- set this_disk to item i of my collection_1
- eject (every disk whose name is this_disk)
- end repeat
- else
- eject (every disk whose name is theDisk)
- end if
- end tell
- end try
- end if
- ###########################################################
- #EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement