Hi
I am writing a script which will automatically map to a selection of servers in our corporate network. The key part of the code is shown below:
global afp_user_name
set afp_user_name to “XYZ” (in the real script this is sourced from a dialog)
property afp_server_list : {¬
“smb://fianna.acme.gov/apps”, ¬
“smb://fianna.acme.gov/images”, ¬
etc
etc
}
The above list is fixed except that individual users have their own shared folder at “smb://fianna.acme.gov/XYZ”
where XYZ is their user name which they enter into the script.
What I would like to do is to incorporate the above user-specific path into the main list of servers. I guess this is a coercion issue. However, everything I have tried doesn’t seem to want to work. I’d really appreciate some working code on this.
Many thanks in advance and regards
Dave Mitchell
Model: G5 Power Mac
AppleScript: 1.10.6
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)
set afp_server_list to (afp_server_list & ("smb://fianna.acme.gov/" & afp_user_name))
?
Even easier
property afp_server_list : {¬
"smb://fianna.acme.gov/apps", ¬
"smb://fianna.acme.gov/images"}
--ie
set afp_user_name to "WW"
set afp_server_list to (afp_server_list & afp_user_name)
Model: 11 macs, all my babies
AppleScript: 2.1.1
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)
An alternate version of Mikey-San’s script:
property afp_server_list : {¬
"smb://fianna.acme.gov/apps", ¬
"smb://fianna.acme.gov/images"}
set afp_server_list's end to ("smb://fianna.acme.gov/" & afp_user_name)
Except that gives you this array:
“smb://fianna.acme.gov/apps”, “smb://fianna.acme.gov/images”, “WW”
Which is not what the OP wanted. You need to concatenate the server name with the user name, like Bruce and I did.
Thanks to all who replied.
The suggestions worked beautifully.
Much appreciated.
Dave Mitchell
Thanks Mikey San
You are of course right and I accept the slap on the wrist.
I must not reply to this forum after alcohol
Regrads adn Godnite