Messages + iTunes Applescript
Hello all,
I have made an applescript to control iTunes via iMessage from my iPhone. It contols volume, play/pause, etc... When I set it as the AppleScript Handler and send a message to my Mac, i get two errors:
The code is as follows:
using terms from application "Messages"
on message receivedtheMessage
if theMessage is "Play" then
tell application "iTunes" to play
else if theMessage is "Pause" then
tell application "iTunes" to pause
else if theMessage is "Volume Up" then
set curVolume to output volume of (get volume settings)
if curVolume < 90 then
set newVolume to curVolume + 10
else
set newVolume to 100
end if
set volumeoutput volumenewVolume
else if the message is "Volume Down" then
set curVolume to output volume of (get volume settings)
if curVolume > 10 then
set newVolume to curVolume - 10
else
set newVolume to 1
end if
set volumeoutput volumenewVolume
else if theMessage is "Play Song" then
tell application "Messages"
set theBuddy to buddy "(My Phone # here)" of service id "81E10DF5-FDED-44F8-BD89-AD2A299465ED"
send "Song Please in 10 Seconds" to theBuddy
delay 10
end tell
set song to theMessage
tell application "iTunes"
activate
playtracksong
end tell
end if
end message received
end using terms from
I have no idea what is wrong, any help is appreciated,
Ryan.
MacBook Pro, OS X Mountain Lion (10.8.4)