Spotify 助手将无法工作

spotify helper won't work

我用 applescript 为 spotify 创建了一个帮助程序。它不会编译

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

问题是您将 "on" 代码放在 "if" 语句中,您必须将 "on" 部分放在 "end if" 之后,并且您有 2 "on musicApp"的你只需要1个,

希望这对您有所帮助!