How do you use an error from finder in a statement

As before I’m trying to make it easier for my users to logon on to their folders on a win2k server. The problem i have now is that their account may be on one of three servers. How do I go about getting my script to recognise that there account isn’t on the main server but on the secondary or tercery server and to try to mount that server instead.

Or if you have a better way of doing it please tell me

on clicked theObject
tell window of theObject
try
set theUsername to contents of text field “username” as text
set thePassword to contents of text field “password” as text
end try
end tell

tell application “Finder”
try
mount volume (“smb://” & theUsername & “:” & thePassword & “@10.0.1.13/” & theUsername & “”)
on error
mount volume (“smb://” & theUsername & “:” & thePassword & “@10.0.1.12/” & theUsername & “”)
end try
end tell
tell window of theObject
set contents of text field “username” to “”
set contents of text field “password” to “”
display dialog (“Drive for " & theUsername & " has been mounted”)
end tell

end clicked[/b]

The other way would be to (if possible) set the script to generate a file with all of the shares available on each server(may be seperate files for each server) and then interigate the file to discover which server has the share relevant to that account, the same list that you get when you connect to a machine through “connect to server” or “chooser”. As you may have guessed the sharename and account name are the same.

What’s missing from your description is the logic behind which server holds the directory you’re trying to mount.

For example, if you’re splitting it based on the first character of the username such that users A through I are on server 1, J through R are on server 2 and S through Z on server 3, that’s easy to incorporate into the script.