mount volume vs. FSMountServerVolumeSync

It seems the “mount volume” command typically used in AppleScript throws an error when used in ASOC. It would be ideal for what I am doing but I can’t get it to work.

[center]malloc: reference count underflow for 0x200036500, break on auto_refcount_underflow_error to debug.[/center]

Instead I found FSMountServerVolumeSync but it’s a bit tricky too and seems to yield no error or results. I’d like it to prompt the user for credentials with the option to store the info in the keychain. Any help would be appreciated.

on mountVolume(thePath)
        set theURL to current application's NSURL's URLWithString_(thePath)
        set theRefNum to current application's FSVolumeRefNum()
        current application's FSMountServerVolumeSync_url_mountDir_user_password_refNumber_flags_(current application's CFURLRef_(theUrl), null, null, null, theRefNum, 0)
end mountVolume

The error you are quoting doesn’t necessarily mean it’s not working – quite a few scripting addition commands return something similar under 10.7.1, but still work. Are you sure it’s not working? (I can’t check here.)

I’m not optimistic about getting FSMountServerVolumeSync working, but it should probably be closer to this:

current application's FSMountServerVolumeSync(theUrl, missing value, missing value, missing value, reference, 0)

Looks like you are right. It does work fine. It turns out the error was being thrown because the path I was feeding it wasn’t coerced (don’t know why it needed to be since it was already text).

FAILED:

mount volume thePath

SUCCESS:

mount volume thePath as text

Thanks for the help. --Andrew