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
Concatenation is the process of appending one string to the end of another string. You concatenate strings by using the + operator. For string literals and string constants, concatenation occurs at compile time; no run-time concatenation occurs. For string variables, concatenation occurs only at run time.
The += Operator in Bash Bash is a widely used shell in Linux, and it supports the '+=' operator to concatenate two variables. As the example above shows, in Bash, we can easily use the += operator to concatenate string variables.
In general, the string concatenation in Perl is very simple by using the string operator such as dot operator (.) To perform the concatenation of two operands which are declared as variables which means joining the two variables containing string to one single string using this concatenation string dot operator (.)
C++ has a built-in method to concatenate strings. The strcat() method is used to concatenate strings in C++. The strcat() function takes char array as input and then concatenates the input values passed to the function. In the above example, we have declared two char arrays mainly str1 and str2 of size 100 characters.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With