---Start Script on run set list_volumes to list folder (path to startup disk as string) & "Volumes:" set select_volumes to (choose from list list_volumes with prompt  "Please select Volumes to unmount:" & return & "(multiple selections allowed)" with multiple selections allowed) if the select_volumes is false then return else repeat with i from 1 to number of items in select_volumes set selected_volume to item i of select_volumes if the (path to startup disk as string) is equal to (selected_volume & ":" as string) then display dialog "You can not eject your startup disk !" buttons ["OK"] default button "OK" with icon stop giving up after "10" else unmount_volume(selected_volume) end if end repeat end if end run on unmount_volume(selected_volume) set volume_name to "/Volumes/'" & selected_volume & " '" as string set mount_line to do shell script "mount | grep -w " & volume_name if (characters 1 thru 5 of mount_line) as text is equal to "/dev/" then set on_position to offset of " on " in (characters 11 thru 22 of mount_line) as text set s_position to offset of "s" in (characters 10 thru 13 of mount_line) as text if s_position is greater than "1" then set count_partitions to do shell script "mount | grep -c " & (characters 1 thru (9 + s_position) of mount_line as text) if count_partitions is greater than "1" then tell application "Terminal" do script "disktool -p " & (characters 6 thru (9 + on_position) of mount_line) end tell else tell application "Terminal" do script "disktool -e " & (characters 6 thru (8 + s_position) of mount_line) end tell end if else tell application "Terminal" do script "disktool -e " & (characters 6 thru (9 + on_position) of mount_line) end tell end if else network_protocol(selected_volume) end if end unmount_volume on network_protocol(selected_volume) set not_disk to "/Volumes/'" & selected_volume & "'/" as string try do shell script "umount " & not_disk on error the error_message number the error_number display dialog "Error: " & the error_number & return & the error_message buttons {"OK"} default button "OK" giving up after "30" end try end network_protocol ---End Script