I want to run an Applescript when I mount a specific disk. It isn't if the script is located on the disk or not, it should just run when OS X mounts the disk.
I tried to accomplish this with folder actions, but it looks like it isn't possible to do it this way.
Clarification:
- I get home with my Macbook
- I plug my USB Hub into the device
- External disks are mounted in OS X
- My Applescript gets run, does some stuff on those disks
I want to automate step 4.
Best Answer
You don't mention under which context you are mounting the disk, but what about going the other way and mounting the disk with the Applescript?
I mention context because when mounting a disk with Applescript is the big caveat that if it is a network volume, and the network is password-protected, then the user name and password would have to be stored as plain text in the script for a seamless execution.
UPDATE: A bit of searching found a similar question elsewhere. Essentially, a script can be made to do this by applying the script as a Folder Action to /Volumes: