afp volume mount script problems

Hi all,
I have script that when run mounts a volume via afp, if it cannot it is to create a log on the desktop. this works great, but if there is ever a networ issue the script trigges a Finder error window that hangs the Finder. Is there a way to “silence” these error dialogs via the script so that it will only write to the log? Here is the script…

on run
try
tell application “Finder”
mount volume “afp://user:pass@ipaddress/mount”
end tell
on error the error_message number the error_number
set the error_text to "Error: " & the error_number & ". " & the error_message
– the following line evokes the sub-routine to write the error into an error log created on the desktop
– if the file “Script Error Log.txt” already exists, it will add one line to the log
my write_error_log(the error_text)
end try
end run
on write_error_log(this_error)
set the error_log to ((path to desktop) as text) & “Mount Volume Error.txt”
try
open for access file the error_log with write permission
write (this_error & return) to file the error_log starting at eof
close access file the error_log
on error
try
close access file the error_log
end try
end try
end write_error_log

Thanks, Chad

Model: G5
AppleScript: 2.0
Browser: Safari 312.3.1
Operating System: Mac OS X (10.4)

I don’t know how. Hopefully someone else will. An alternative might be to use mount via a do shell script and capture stderr to see if it suceeded?

http://www.hmug.org/man/8/mount_afp.php

I’m having a nightmare time trying to get rid of these damn messages too. If I tell the Finder to close all windows, it tells me it’s busy. I can’t make it click on the ok button itself.

The only thing I found that might help is to ping the server, but for me this isn’t reliable enough, here’s the code anyway…

tell application "Terminal"
	set pingResult to do shell script "/sbin/ping -c 1 serverIPaddress"
end tell
if (pingResult contains " 0% Packet") then
--mount away...

Something I’ve just found to work - killing the Finder with the killall command in terminal. Drastic, but it seems to be the only way I can get rid of the damn message. Stops the program running too, I expect, but it’s better for me that way.