It’s always the simple solution…
I ran your “scrippet” and discovered that there was a space after the name in one of my folder paths (FU2:Yarra HD :DATA:matlab data:). Once this was incorporated into the script, everything fell into place! Thanks again for all your help, it makes a huge difference!!
Here’s a revised version of the script that (a) checks to see if FU2 is mounted and (b) checks to see if MATLAB is running. It should mount the disk only when it isn’t mounted and launch MATLAB only if it isn’t running.
on adding folder items to thefolder after receiving theAddedItems
tell application "Finder"
activate
if (exists disk "FU2") is false then ¬
mount volume "afp://username:password@xxx.xx.xxx.xxx/FU2"
repeat with item_ in theAddedItems
duplicate item_ to folder "FU2:Yarra HD :DATA:matlab data:"
end repeat
if (exists process "MATLAB") is false then ¬
tell application "MATLAB" to activate
end tell
end adding folder items to
I’m glad that you found the problem and I hope it’s always the simple things!