You can associate AppleScript scripts with folders. Take a look at Folder Actions Reference
A Folder Action script is executed when the folder to which it is attached is opened or closed, moved or resized, or has items added or removed.
Question
experts. what I want is like this: I create a folder named RootDir
, then I double click the folder in Finder , I hope I can intercept the action and trigger specific action such as mounting this RootDir
to another folder named MountDir
and then open MountDir
, not RootDir
.
How should I do it (Using objective-c)? my platform is mountain lion (osx10.8) and I've tried using fsevent to monitor, but i don't think i can catch the action of folder open/close.... And is it the only way for me to use Finder injection to achieve this function? any suggestions would be appreciated.
La solution
You can associate AppleScript scripts with folders. Take a look at Folder Actions Reference
A Folder Action script is executed when the folder to which it is attached is opened or closed, moved or resized, or has items added or removed.