Here's a testing code:
tell application "Spotify"
set playerState to player state as string
end tell
display dialog playerState
Works fine from the AppleScript editor. However, when I export my script as an app, all I get is this:
Why is this happening?
It's better to use this code to obtain the player state. You don't need to know the exact constant values. Works on OS X 10.13
It seems that Spotify is not coercing the constant into a string. Since the editor can't coerce it from an applet as it does when you are running the script in AppleScript Editor, the four-letter constant code is returned. Since you can't test the player state's value as a string, try to test it against the constants themselves.