Applescript to run when iPhone connects/disconnects I'm trying to figure out how to run an applescript when I connect and disconnect my iPhone with the USB cable.

So far, I think I can run an applescript when it connects by using Image Capture (setting "connecting this phone opens" to "other" and selecting the script).

I don't know how to run a script when the phone is disconnected however. Ideas?
Is this sort of what you're looking for?


  Usbmux
  
  ...usbmuxd then watches for iPhone connections via USB; when it detects an iPhone running in normal mode (as opposed to recovery mode), it will connect to it and then start relaying requests that it receives via /var/run/usbmuxd – this is to say, usbmuxd is the only thing that actually speaks USB to the iPhone.


http://theiphonewiki.com/wiki/Usbmux