Execute an application on Mac OS X when a particular type of USB device is connected?

前端 未结 5 2252
感动是毒
感动是毒 2020-12-14 03:32

I need to implement a Mac OS X application. In my application I need to do two things:

  1. Execute / Open an application when a particular type of USB device is c
5条回答
  •  既然无缘
    2020-12-14 04:02

    You may be able to set Folder Actions to run a command on mount. This would assume that the device always mounts in the same place, i.e. /Volumes/My\ Device/ - if peripherals were added or removed in between mounts, the mount point may change. You can learn more about Folder Actions by right clicking a directory and clicking "Folder Actions Setup". The trick would be to make sure that the device always mounts in the same place.

    Alternatively, you may be able to use launchd to run a command on mount. This link may help. Lingon is a great app to edit daemons.

    Either way, you could use the Folder Action or daemon to call a simple script to grab the contents of the device and upload them to wherever you please.

提交回复
热议问题