connect to server

Hi
I’m trying to connect to a server, but I have a problem. The applescript timeout is 1 minute (default), but I don’t want to wait as long, so I used the “with timeout” command. The problem is, that Applescript waits the time amount I told it, but the Finder hangs until this minute is passed…
This happens by smb or afp connections, if the specified server couldn’t be found

works, but Finder hangs up for 1 minute:

with timeout of 2 seconds
	try
		tell application "Finder" to mount volume "smb://10.0.1.6"
	on error
		display dialog "could not connect to server 10.0.1.6"
	end try
end timeout

and this doesn’t work:

with timeout of 2 seconds
	try
		mount volume "smb://10.0.1.6"
	on error
		display dialog "could not connect to server 10.0.1.6"
	end try
end timeout

this works a lot better than the way your attaching the problem

set serverIP to "192.168.0.174" --enter the ip of the server here
set ShareName to "TORRENTS" -- enter the share name here ***Make sure it is in "CAPS"
set sharename2 to "DOWNLOADS"

try
	set ping_result to (do shell script "ping -c 1 -q " & serverIP)
end try
--only edit the above code
tell application "Finder"
	if "100% packet loss" is not in ping_result then
		if (list disks) does not contain sharename2 then
			mount volume "smb://" & serverIP & "/" & sharename2
		end if
		if (list disks) does not contain ShareName then
			mount volume "smb://" & serverIP & "/" & ShareName
		end if
	end if
end tell

Thanks
But I have a text field for the connection address, like the “Connect to server…” in the Finder, how do I get the ip, if someone is using the name instead of the ip (e.g. afp://user:password@mycomputer.local/test or afp://mycomputer.local/test) ?

ok i think this will help you
try my scrip out it works if type either WINXP or 192.168.0.174
you may have to modify the ls command bit but this script works for me, im only new to applescript and helping with this cause i want to learn it, so i dont mind helping

set the result to display dialog "Enter the Server Name (or IP)" default answer "192.168.0.174" buttons {"OK", "Cancel"} default button 1
set server to text returned of result
tell application "Finder"
	try
		set ping_result to (do shell script "ping -c 1 -q " & server)
		if "100% packet loss" is not in ping_result then
			mount volume "smb://" & server
		end if
	on error
		set host_name to do shell script "ls /Network/"
		
	end try
	
	if host_name contains server then
		mount volume "smb://" & server
	end if
end tell