How do I automatically run an application on USB attach or CD insert on Mac OS X?

后端 未结 5 894
灰色年华
灰色年华 2020-12-30 00:14

Is there any way to automatically launch an application on USB attach or CD insert on Mac OS X? it\'s easy on Windows, but I found that AutoRun.Inf does not wor

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-30 00:40

    If you are looking for something for just yourself, you could write a small mac app that runs in the background and watches for a particular USB device (by id) to be attached and then run the program. Ideally a small XML plist could be used to map device IDs to the correct program to run. The XCode SDK has sample code that monitors for device additional and removal to get you started.

提交回复
热议问题