Advertisement
Guest User

Untitled

a guest
Mar 26th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set diskName to "BOOTCAMP"
  2.  
  3. tell current application
  4.     set deviceLine to (do shell script "diskutil list | grep \"" & diskName & "\" | awk '{ print substr($0,69,9) }'")
  5.     if deviceLine = "" then
  6.         display dialog "The disk \"" & diskName & "\" cannot be found." buttons {"OK"} default button 1 with title "Error" with icon caution
  7.     end if
  8.     set foundDisks to paragraphs of deviceLine
  9. end tell
  10.  
  11. tell application "Finder"
  12.     if disk diskName exists then
  13.         tell current application
  14.             repeat with i from 1 to number of items in foundDisks
  15.                 set this_item to item i of foundDisks
  16.                 if this_item contains "disk" then
  17.                     do shell script "diskutil unmount /dev/" & this_item
  18.                 end if
  19.             end repeat
  20.         end tell
  21.     end if
  22. end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement