Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Neyiox

macrumors newbie
Original poster
Jul 16, 2017
2
0
Hi everyone,

This is my first post on the forum and I would need some answers for a problem.

Everything is in the title! I recently bought an USB key of BB-8 (Star Wars) and I would like to get a sound (that I already have) when I insert my key.

I'm under Sierra 10.12.5

Thank you in advance for your answers which I hope will help me.

Good night!
 
AFAIK, there is no such easy solution on a Mac like writing an autorun.inf on Windows.
Maybe better ask this at the programmers forum.

I guess writing a Launch Daemon to watch the USB key insertion would be best practice over running some other kind of background app. Then you could involve an AppleScript or some other script to play the sound.

A specific volume can be identified by its UUID. To get it, plug-in your USB key and type the following in Terminal with the proper name of your USB key
Code:
diskutil info /Volumes/NameOfUSBDrive | grep UUID

To get an idea for the Launch Daemon take a look here:
https://stackoverflow.com/questions...when-a-particular-type-of-usb-device-is-conne
https://developer.apple.com/library...stemStartup/Chapters/CreatingLaunchdJobs.html

For the AppleScript something like this could work:
http://www.leancrew.com/all-this/2007/12/playing-sounds-in-applescript/

Edit: better than a third party sound app to play the sound is the use of built-in afplay
https://discussions.apple.com/thread/2408021

Hope this helps to get the direction.
 
Last edited:
Thank you for your answer!

I'm gonna check this even if I'm not an expert in code
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.