I want to have a macro that Play/Pause if Apple Music is in a playlist (any playlist), and that if will switch to "New Daily Music" Playlist if no playlist is open (when apple music start there is no playlist open so play/pause has no effect)
It doesn't seem possible today, is it?
I was trying to add a "If - Then" actions but I don't see any condition that is related to apple music.
You may be able to use Shortcuts, but I don't have that here. So here's an AppleScript that should do what you want (tested on iTunes rather than Music, but should work):
tell application "Music"
try
get name of current playlist
playpause
on error
tell playlist "New Daily Music" to play
end try
end tell
...which works because trying to get the name of the current playlist when one isn't set will throw an error.
Pop the above into a KM "Execute an AppleScript" action and you should be golden, no need for a KM "If Then Else" unless there are other things you want to do too.
tell application "Music"
if (exists current track) then
log name of current track as text
return
end if
activate
reveal playlist "New Music Mix"
set shuffle enabled to true
set shuffle mode to songs
delay 2
play first track of playlist "New Music Mix"
pause
end tell
the applescript check if there is current track if there is it end the script right there.
If there is no "current track" we need to activate the application (Apple Music), because otherwise the play/pause does not work if Apple Music was started by this script.
We "open" the playlist called "New Music Mix", this does NOT change the current track.
So I need to play and then pause to select the track.