identifying volume exists

Hi,

I’m still quite new to the scripting world but I believe to have a very simple question. I’m writing a script in the lab environment that mounts a fileshare volume, runs an application and ultimately monitors the exists of both during the idle phase to ensure an error-free environment. Unfortunately after adding a “fail safe” to the idle section I’m having a problem - I want there to be an error message when the volume isn’t found and to quit the program. This works fine when the network connectivity is severed, yet when the volume is mounted, exists cannot identify it and the script reports an error despite everything being OK. Here’s what I have in the idle section thus far:

on idle
tell application “System Events” to (process “program” exists)
if not result then
try
tell application “Finder” to eject disk “volume”
quit me
end try
end if

tell application "System Events" to process disk "volume" exists
if not result then
	try
		tell application "Finder"
			display dialog " Yeah, you need to check the network cable or verify the AirPort connectivity is valid." buttons {"OK"} default button 1 giving up after 15
			quit me
		end tell
	end try
end if
return 0.5

end idle

There must be an easier way besides having validation of multiple exists - possibly a set to command? Anyone??

Model: MacBook
AppleScript: 2.1.1 (81)
Browser: Firefox 2.0.0.11
Operating System: Mac OS X (10.4)

Hi,

there is no process “disk” in System Events,
either you check

tell application "System Events" to exists disk "volume"

or without the Finder or System Events

"volume" is in (do shell script "ls /Volumes")

or

"volume" is in (list disks)

I prefer the do shell script version, list disks responds sometimes slowly to quick changes

Thank you Stefan, that works great on all of my LAN based apps!!! (I’m using the System Events option). I appreciate the quick reply :smiley: