I'm creating an AppleScript for my Mac that will tell Spotify to skip or go back a track based on keyboard shortcuts. I believe I have the code correct but cannot get the script to work properly and think it may be due to the if-then statements' positioning.
Any tips on what I can do to make this work?
tell application "Spotify"
activate
if keystroke "e" using {command down, option down, control down} then
tell application "Spotify"
next track
end if
end tell
if keystroke "r" using {command down, option down, control down} then
tell application "Spotify"
previous track
end if
end tell
ifstatements are not doing anything and they are not even valid statements in that they do not provide any mechanism to even determine if a key press event occurred! Additionally, as written your AppleScript code does not even compile and therefore cannot even be executed. - user3439894