Reputation: 59
I resonantly created a helper for spotify using applescript. It won't compile
display dialog "Volume or Controls" buttons {"Volume","Controls"}
if button returned of the result is "Controls" then
my musicApp()
on musicApp()
display dialog "Controls" buttons {"Skip","Play/Pause","Rewind"} default button 2
if button returned of the result is "Skip" then
tell app "Spotify" to activate
delay 0.5
tell app "System Events"
key code 124 using {command down}
end tell
else if button returned of the result is "Rewind" then
tell app "Spotify" to activate
delay 0.5
tell app "System Events"
key code 123 using {command down}
end tell
else
tell app "Spotify" to activate
delay 0.5
tell app "System Events"
keystroke space
end tell
my musicApp()
end musicApp
end if
else
my musicApp()
on musicApp()
display dialog "Volume" buttons {"Volume up","Volume down"}
if buttone returned of the result is "Volume up" then
tell app "Spotify" to activate
delay 0.5
tell app "System Events"
key code 126 using {command down}
end tell
else
tell app "Spotify" to activate
delay 0.5
tell app "System Events"
key code 125 using {command down}
end tell
my musicApp()
end musicApp()
end if
end if
Upvotes: 0
Views: 66
Reputation: 1083
The problem is that you put the "on" code in the "if" statement, you have to put the "on" part after the "end if" and you have 2 "on musicApp"'s you only need 1,
hoped this helped!
Upvotes: 2