Use Dropbox in an encrypted sparse bundle (and delayed app load on login)

I've recently moved my local [Dropbox](https://www.dropbox.com/referrals/NTY3ODc2OQ) folder to a folder that lives in an encrypted sparse bundle. I have nearly 50GB of data in Dropbox, and it was starting to take a toll on my startup volume, which is small—a 250GB SSD. I changed the folder from within the Dropbox preferences area, and it moved my files over successfully. This setup only works if the encrypted volume is mounted before Dropbox loads (Dropbox complains, otherwise). In particular, this is an issue if Dropbox loads on startup (and the encrypted volume has not yet mounted). I solved the problem by using an AppleScript that mounts the sparse bundle, waits a few seconds, and launches Dropbox. I added the AppleScript to my Login Items, and it is all working perfectly. You must save the sparse bundle password to your keychain for this to work.

do shell script ("hdiutil mount "/Location/of/sparse/bundle/volumename.sparsebundle"")

set theAppList to {{name:"Dropbox", vis:false}} set theDelay to 5

repeat with currentApp in theAppList tell application (name of currentApp) to launch delay theDelay tell application "System Events" try if background only of process (name of currentApp) is false then set visible of process (name of currentApp) to (vis of currentApp) end if end try end tell end repeat

Note that one can use the same script (without the "hdiutil mount" part) to launch an arbitrary number of applications after a delay. Delayed launch script source: [MacWorld Hints](http://hints.macworld.com/article.php?story=20091108173250445)

**WARNING**: This setup can really screw up applications that sync using Dropbox. Your Dropbox will no longer always be available because it can be unmounted. Do this at your own risk.