Guest User

Untitled

a guest
Jul 21st, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Adds currently selected folder Finders Favorites sidebar
  2. on addToFavorites()
  3.    
  4.     tell application "Finder" to activate
  5.     tell application "Finder" to select window 1
  6.    
  7.     tell application "System Events"
  8.         tell process "Finder"
  9.             tell menu bar 1
  10.                 tell menu bar item "File"
  11.                     tell menu "File"
  12.                         click menu item "Add to Sidebar"
  13.                     end tell
  14.                 end tell
  15.             end tell
  16.         end tell
  17.     end tell
  18.    
  19. end addToFavorites
  20.  
  21. --Wait for all external drives to mount
  22. repeat
  23.     tell application "Finder"
  24.         if disk "Backup" exists then
  25.             exit repeat
  26.         else
  27.             delay 1
  28.         end if
  29.     end tell
  30. end repeat
  31.  
  32. repeat
  33.     tell application "Finder"
  34.         if disk "Time Machine" exists then
  35.             exit repeat
  36.         else
  37.             delay 1
  38.         end if
  39.     end tell
  40. end repeat
  41.  
  42. repeat
  43.     tell application "Finder"
  44.         if disk "Dropbox" exists then
  45.             exit repeat
  46.         else
  47.             delay 1
  48.         end if
  49.     end tell
  50. end repeat
  51.  
  52. repeat
  53.     tell application "Finder"
  54.         if disk "Shared" exists then
  55.             exit repeat
  56.         else
  57.             delay 1
  58.         end if
  59.     end tell
  60. end repeat
  61.  
  62. --Navigate to each disk and folder and then add the current selection to Finders Favorites sidebar
  63. tell application "Finder"
  64.    
  65.     make new Finder window
  66.    
  67.     set target of window 1 to folder "Projects" of disk "Working"
  68.     my addToFavorites()
  69.    
  70.     set target of window 1 to folder "Documents" of disk "Working"
  71.     my addToFavorites()
  72.    
  73.     set target of window 1 to folder "Dropbox" of disk "Dropbox"
  74.     my addToFavorites()
  75.    
  76.     set target of window 1 to folder "Downloads" of disk "Archive"
  77.     my addToFavorites()
  78.    
  79.     set target of window 1 to folder "Temporary" of disk "Working"
  80.     my addToFavorites()
  81.    
  82. end tell
  83.  
  84. tell application "Finder" to close window 1
Add Comment
Please, Sign In to add comment