check if volume mounted

I copied a script from here to connect to a samba share smb://server/home and works great. How do I run a check to see if this volume(home) is mounted prior to connecting again?

You can try this code:

repeat
	try
		"foo" as alias
		exit repeat
	end try
	delay 1
end repeat

I have been experimenting with this as well. So far I have gotten the following to work, but if someone has a better way, be sure to post it.

tell application "System Events"
	try
		if (exists disk "YOUR_VOLUME_NAME") then
			set Volume_present to yes
		else
			set Volume_present to no
		end if
	end try
end tell

now you just need to see if the the variable Volume_present is either yes or no. You can do this via:


if Volume_present is equal to yes then
 -- do something
else
-- do something else
end if

Hope this helps; and does someone have any idea if the checkifexists command can be used for that?

elreverend