Advertisement
applehelpwriter

MountAll

Mar 30th, 2013
1,427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (*
  2. Mount all available volumes specified in the "set gDiskList to" list (Line 23)
  3. OS X Mountain Lion (10.8.3)
  4. by Applehelpwriter.com, Mar 2013.
  5. *)
  6.  
  7.  
  8. ---------------------------------------------------
  9. global gDiskList
  10. global gMountList
  11. set gMountList to {}
  12.  
  13.  
  14.  
  15. ---------------------------------------------------
  16.  
  17. (*
  18. Replace the example volume names with your own volume names inside the curly brackets in Line 23 below;
  19. Names must be quoted and comma separated as shown.
  20. Spaces in names ARE allowed. You can name as many or as few volumes as you wish.
  21. *)
  22.  
  23. set gDiskList to {"Buffalo 500GB", "Time Machine (FW800)", "External HD", "My Movies USB"}
  24.  
  25.  
  26.  
  27. ---------------------------------------------------
  28.  
  29. tell application "System Events" to get the name of every disk
  30. set mountedList to the result
  31. checkLists(mountedList, gDiskList)
  32. mountDisks(gMountList)
  33.  
  34.  
  35. ---------------------------------------------------
  36. on checkLists(list1, list2)
  37.     try
  38.         repeat with i in list2
  39.             if i is in list1 then
  40.                 display dialog ("The disk " & i & " is already mounted!")
  41.             else
  42.                 set end of gMountList to i
  43.             end if
  44.         end repeat
  45.     end try
  46.    
  47. end checkLists
  48.  
  49.  
  50.  
  51. ---------------------------------------------------
  52. on mountDisks(list_n)
  53.     try
  54.         repeat with i in list_n
  55.             set i to quoted form of i
  56.             do shell script "diskutil mount " & i
  57.         end repeat
  58.     end try
  59. end mountDisks
  60.  
  61.  
  62. --EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement