Control an OSX app by Arduino I am trying to control an app on OSX with an Arduino Uno. Specifically, I would like to start and stop play of an MP3 on iTunes, or a track on Spotify, using an Arduino connected to the Apple computer with USB.

I can print to serial from the Arduino. I can use Screen in Terminal to access the Serial info from the Arduino. I can start and stop playing of tracks on iTunes and Spotify using Applescript. I need some way of having keywords in Screen to trigger start and stop in iTunes or Spotify. I have searched for this in various ways, but cannot find anything other than suggestions to write a script to interface between Screen and Applescripts. This is where I am stuck.

Any suggestions would be greatly appreciated.
This is probably far too broad to provide a practical answer, but here's an outline of how you'll need to reason about automating OS X.

Try to pick an app that is built for automation: https://www.macosxautomation.com

If you can leverage that interface, you'll be very much closer to a solution. If not, there are three more general purpose methods to control OS X:


command line scripting - so you'd need to have the arduino ssh in to the Mac OS as a legitimate networked device just as you could ssh in to OS X from ubuntu, Windows, iOS or any other OS. Once your arduino can open a network connection to OS X - you can use AppleScript, JavaScript, bash, swift and many other languages to send messages to iTunes or other scriptable apps.
USB interface - Apple designs the OS to be accessible to foot switches, screen readers, breath control, joysticks. If you were savvy enough to program your arduino to emulate an assistive device then you could go to the Accessibility system preference pane and then allow your arduino to control the mouse, the keyboard, etc...
voice control. The macOS changes would let you start work on your arduino to synthesize a voice and then connect the voice synthesizer to your sound input (or just use a microphone) to speak to the OS. http://www.practicalarduino.com/projects/speech-synthesizer


Again - these might be a large project for anyone that has no background, so you will want to focus on automating your OS X automation first. Once you can play/pause things on OS X to OS X - then you can see if you can replicate those things from arduino.

If you wanted to have the arduino send serial commands to a program on the Mac - you'd need to first learn to program how to process serial input and then you'd need to learn how to have that program script one of the above methods. Again - you'll need to focus on small achievable steps and then build on them to make a system.