Controlling an OSX app by Arduino
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