Check then Mount external drive

Hello,
I need to mount an external drive which is defined in a Preference window and stored as a plist. Currently I perform this by the included code whichI have not adapted to use the plist variable MySecondServerPath in the folder item
The first loop of checking Volumes on a MC OSX 10.7 takes about 5 seconds to perform. the second loop can take about 15 seconds to perform

Any thoughts on how to speed this up and make this a bit more fault tolerant?
One thought on speeding this up would be to ping the server IP to see if it exists. Then I could throw a message box, send email etc if it does not exist. How would you ping a server using an IP and trap on a result? I do this all the time setting up networks using CLI but never accomplished this successfully in REAL/XOJO.

[code] Dim VolName As String
Dim d As Date
Dim Volnum As Integer
Dim n, i as Integer
Dim f As FolderItem

VolName = “”
n = VolumeCount-1

//Get all mounted volumes
For i = 0 to n
'— Need to integrate MySecondServerPath in the folder item request
f = FolderItem(Volume(i).Child(“passed”))
If f <> Nil And f.Exists Then
VolName = Volume(i).Name
Volnum = i
Connected_to_server_audio_drive = True
Connected_to_Server_audio_retry = False
Current_Log_file_Running_increment = _
write_running_Log (0, “| Volume ‘passed’ connection exists and is connected. Inside Check_Drive_Connection.Connect_to_drive”, _
File_Running_Log_Directory, Current_Log_file_Running_increment)
Return
End
Next

If Connected_to_server_audio_drive Then
// If we get to here then we already were connected and we lost connection
Connected_to_Server_audio_retry = True
End

// Check to see if ‘passed’ is available. If not log in and make it available
While 0 < 1
i = VolumeCount - 1
x = VolumeCount - 1

ShowURL "smb://username:password@IP_Address/Folder_Location(s)"

YieldTime(10000)

n= VolumeCount-1

For i = 0 to n
  f = FolderItem(Volume(i).Child("passed"))
  If f <> Nil And f.Exists Then
    VolName = Volume(i).Name
    Volnum = i

      Current_Log_file_Running_increment = _
      write_running_Log (0, "| Volume 'passed' connection has been lost. Inside Check_Drive_Connection.Connect_to_drive and is reconnected", _
      File_Running_Log_Directory, Current_Log_file_Running_increment)
      
    Connected_to_server_audio_drive = True
    Connected_to_Server_audio_retry = False
    Return
  End
Next i

Wend

Connected_to_server_audio_drive = False
Connected_to_Server_audio_retry = True

Current_Log_file_Running_Error_increment = _
write_running_Log_Error (5, “| Volume ‘passed’ not connected. Inside Check_Drive_Connection.Connect_to_drive”, _
File_Running_Log_Error_Directory, Current_Log_file_Running_Error_increment)

[/code]