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.