concatenate a string and a variable into a string in applescript

jeremyjjbrown picture jeremyjjbrown · Aug 26, 2011 · Viewed 21k times · Source

I have to write an Applescript to automount a folder depending on the user. Applescript Editor throws this error.

A end of line can’t go after this identifier.

Here the portion of the script that is throwing the error.

try
    set short_name to do shell script "whoami"
    set path to "afp://fileserver.local/Faculty/" & short_name
    mount volume path as user name short_name
end try

Answer

Bertrand Marron picture Bertrand Marron · Aug 26, 2011

path can't be a variable name.

try
    set short_name to do shell script "whoami"
    set p to "afp://fileserver.local/Faculty/" & short_name
    display dialog p
end try

Works fine.