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

    MyRomeo

    Joined:
    Jul 22, 2010
    Location:
    United Kingdom
    #1
    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://192.168.0.2/Directory"

    The authentication is handled by keychain.

    Now, the sparesebundle resides at

    smb://192.168.0.2/Directory/Folder/file.sparsebundle

    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

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #2
    I think you could do it with the below shell script in your Applescript.

    Code:
    hdiutil attach -mountpoint ~/myMountPoint mySparsebundle.dmg
    
     

Share This Page