MacOS – Can’t mount Volume via Applescript as a login time

applescriptmacos

So I have this script that I saved as an application and added it my login items.

tell application "Finder" to mount volume "afp://Data_Cube.local/Scotts Stuff"
delay 5
tell application "iTunes" to activate

However when I login I get an error dialog with this message "Connection is invalid.
Finder got an error: Connection is invalid. (-609)"

If I click the edit button in the error dialog it opens up the Script Editor. I press the run button and the volume is mounted just fine.

Any ideas why my volume won't mount when used as a login item? FYI I'm using Yosemite.

Best Answer

Changing

tell application "Finder" to mount volume "afp://Data_Cube.local/Scotts Stuff"

to

mount volume "afp://Data_Cube.local/Scotts Stuff"

seems to be the resolution. As mount is part of the standard scripting library.