Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am using an applescript to mount a users home folder. However, when I use a password with a "@" symbol the script fails since the "@" symbol is also the separator between the password and servername? Anyway around this outside of changing the password?

Thanks

Here is the script:

display dialog "Please enter your username" default answer ""
set the user_name to the text returned of the result

display dialog "Please enter your password" default answer "" with hidden answer
set pass_word to the text returned of the result

set server_name to "servername"
set share_name to "sharename"
mount volume "smb://" & user_name & ":" & pass_word & "@" & server_name & "/" & share_name & "/" & user_name
share|improve this question
1  
instead of @ use % for it –  Buscar 웃 Apr 21 '13 at 20:59
    
Note that on most Unices, you don't want to put passwords in command lines because they can then be viewed with ps and the like. –  Reid Apr 23 '13 at 20:03
add comment

1 Answer

up vote 3 down vote accepted

Rather than using the in-line form to give the username and password, you can specify them as parameters for the mount volume command. Changing the final line to the following will work with passwords with special characters:

mount volume "smb://" & server_name & "/" & share_name & "/" & user_name as user name user_name with password pass_word
share|improve this answer
    
Thanks robmathers! –  MooseKnuckle Apr 22 '13 at 18:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.