Controlling my music in "Music/iTunes" & Spotify at the same time

Apologies for my ignorance. I’m not a coder. I bought KM specifically to control my music apps globally so that I can hit keyboard commands in whichever app I’m in to to play/pause and next/previous track.

Most times I have both spotify and apple music open at the same time. (I like to use spotify’s radio feature but I also listen to my own music).

I would like to create a command where I have one keyboard short cut to 1)play/pause 2)next track 3)previous track that will be sophisticated enough to know whether or not to act on spotify or iTunes.

So something like…

if iTunes is playing, pause iTunes. If iTunes is not playing pause spotify.

If iTunes is not playing, hitting “next track” would hit next on spotify and not in iTunes.

Is this possible?

I was trying to use ^Right Arrow. And used the same keyboard shortcut for iTunes and spotify. But when I hit the shortcut it gives me little window where I select which one I want to do. I tried to use some if statements and copy code from some other scripts I found but I couldn’t get it to work.

If anyone knows the script I need that’d be a great help! Thanks, I really like the functionality of KM, I just need to learn how to code :frowning:

Take a look here: