Mac Automator - Monitor network share and quit..

philstone

macrumors 6502
Original poster
Oct 13, 2008
404
10
Jersey, Channel Isles
Hi all,

Does anyone know if its possible to create a workflow/package that monitors connectivity to a networked folder and if the connection breaks, either displays a warning message, or quits a specific application?

I have a program that depends on connectivity to a share, however the program doesn't do anything if the connection breaks.. :(

Cheers
 

superscape

macrumors 6502a
Feb 12, 2008
930
218
East Riding of Yorkshire, UK
The basics of an AppleScript based solution would be something like this:

Code:
on idle
   if (list disks) does not contain "Your Share Name Goes Here" then
       activate
       display dialog "Where is it?" buttons {"OK"} giving up after 5
   end if
end idle

...save it as a stay open applet.

Whenever the Mac is idle, the app will pop up the warning if a share with the name you define is not in the list of mounted shares. It's only intended to be a snippet to get you started - you'll probably want to finesse it somewhat!

Its a bit of a clunky solution. There are probably slicker ways, but it should work.

Good luck
 

philstone

macrumors 6502
Original poster
Oct 13, 2008
404
10
Jersey, Channel Isles
Thanks, I only want this to run when the application that depends on the share is running.

Thinking about it, thats not really going to be possible without having it running constantly and first of all performing a check for whether the application is open or not. How much of a resource drain would this have? Negligible?

Thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.