property MusicPlayerName :"iTunes"
tell MusicPlayerName
set {curtrnm, cureqnm} to {(the name of current track), the name of the current EQ preset}
end tell
I accidentally missed “application” in my post but it keeps throwing the error nonetheless. I need to have its name in a variable only as my another script is dependant on that.
Terminologies are different and even if passing the application name in a variable worked (it does not) keywords related to iTunes in a Safari tell block is pointless anyway.
What is the sense of executing current track in an environment which doesn’t understand this statement? Once again almost any terminology is tied to a specific application.
If you want wrote universal Music & iTunes script, you can use critical code’s text representation. Like this:
-- detect what music app is installed
try
application id "com.apple.iTunes"
set MusicPlayerId to "com.apple.iTunes"
on error
set MusicPlayerId to "com.apple.Music"
end try
-- critical code's text representation
set universalMusicScript to "tell application id \"" & MusicPlayerId & "\"" & linefeed & ¬
"return {name of current track, name of current EQ preset}
end tell"
-- do script
set {curtrnm, cureqnm} to run script universalMusicScript