Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set diskName to "usbshare1"
- tell application "Finder"
- if disk diskName exists then
- eject disk diskName
- else
- tell current application
- set deviceLine to (do shell script "diskutil list | grep \"" & diskName & "\" | awk '{ print $NF }' }'")
- if deviceLine = "" then
- display dialog "The disk \"" & diskName & "\" cannot be found." buttons {"OK"} default button 1 with title "Error" with icon caution
- end if
- set foundDisks to paragraphs of deviceLine
- repeat with i from 1 to number of items in foundDisks
- set this_item to item i of foundDisks
- if this_item contains "disk" then
- do shell script "diskutil mountDisk /dev/" & this_item
- end if
- end repeat
- end tell
- end if
- end tell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement