On device mount

Is there a way to detect when my drive “DUMPY” mounts? And then when it dismounts?

Is it possible to have this run hidden so that no dock icon or application switch icon shows?

Okay. I have something. Is there a faster/more efficient way than the following?

set theDisks to list disks
if theDisks contains "DUMPY" then
	display alert "It is there!"
else
	display alert "It is not there!"
end if

Lots of ways:

  1. use an ‘on idle’ stay-open application to periodically check the name of disks:
on idle
	tell application "Finder" to set D to name of disks
	if D contains "Dumpy" then
		-- do stuff
	end if
	return 10
end idle

This can be hidden using James Sentman’s Backgrounder

Or, read this article by Craig Smith, and use launchd

Or attach a folder action to /volumes/