Advertisement
Guest User

Untitled

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