applescript help : Auto mount sparsebundle image at login

Discussion in 'OS X Mountain Lion (10.8)' started by MyRomeo, Nov 13, 2012.

  1. MyRomeo macrumors 6502


    Jul 22, 2010
    United Kingdom
    Hi, I wonder if you can help me out.

    I currently have a MBA and WD NAS on which I have a 130gb sparsebundle image file that I would like to use for the wifes iPhoto collection. To do this I manually 'mount' this sparsebundle and it has the iPhoto library saved on it.

    At the moment I have an applescript that runs at startup to connect to and mount the NAS volume. I am trying to get this script to then mount the sparsebundle image too but can not get it to work. I either get a compile error or a 'server not available' error.

    The script looks like this:

    mount volume "smb://"

    The authentication is handled by keychain.

    Now, the sparesebundle resides at


    How can I modify my simple script so that it connects and mounts the NAS volume THEN mounts the sparsebundle? Perhaps it needs some logic in to wait or check for the NAS volume before proceeding with the sparsebundle?

    I tried adding the sparsebundle to the user login items but this is where I get the server not available error. I can get the nas volume working both in login items or via script. The sparsebundle mounts and works perfect when mounted manually. 300mbps 5ghz N is a charm :)
  2. Weaselboy Moderator


    Staff Member

    Jan 23, 2005
    I think you could do it with the below shell script in your Applescript.

    hdiutil attach -mountpoint ~/myMountPoint mySparsebundle.dmg

Share This Page