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.

Any suggestions would be greatly appreciated.

  • This sounds more like an OSX question than an Arduino one. If the things you want to do can be done by a keyboard, you can get a Leonardo type board and be a keyboard. Otherwise you will probably need custom software on the Mac which takes custom messages from the Arduino and turns them into actions. The hard part will be coming up with the Mac side - since it is custom, the Arduino side can be trivial, for example just Serial.println("pause itunes"); Aug 7, 2016 at 5:43
  • You could write a small script that interfaces through serial to the Arduino and forwards commands and instructions on to other places using AppleScript.
    – Majenko
    Aug 7, 2016 at 9:58
  • @Majenko that is exactly what I'd like to do. But how? I suppose I should ask the question on 'Ask Different'?
    – Fed
    Aug 7, 2016 at 12:04
  • 90% of what you are wanting to do would be Apple programming. Not something we know much about here.
    – Majenko
    Aug 7, 2016 at 12:05
  • We can help you with the Arduino side of things, but that would just be simple serial operations really.
    – Majenko
    Aug 7, 2016 at 12:05

1 Answer 1


I am now having Screen output to log.txt, and the following applescript works just great!

set trigger to 1

set stopString to ""

repeat until (stopString = "stop")

set testTxt to paragraphs of (read POSIX file "/Users/fed/log.txt") set countTxt to (count of testTxt) - 1 set lastLine to item countTxt of testTxt
if lastLine contains "Start MP3" and trigger is 1 then tell application "Spotify" to playpause set trigger to 0 end if

if lastLine does not contain "Start MP3" then set trigger to 1 end if

if lastLine contains "Stop Loop" then set stopString to "stop" end if end repeat

  • Applescript can read stuff from a .txt file, and cause an event on a specific word? Then you'll indeed only need a program that takes serial input (USB COM-port) and put it in a file.
    – aaa
    Sep 11, 2016 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.