"No result was returned from some part of this expression."

Tried searching first; several posts with the same error message. But, either the solution doesn’t apply or OP left us hanging with the solution.

Trying to create an uber-simple dock app to pause my music when the phone rings. the same snippet using the mute property works fine; but, when trying to use the playpause command i get the error: "“No result was returned from some part of this expression.”

The script runs fine and toggles the play/pause condition of the music player. I just get the error popup each time.

working mute property script:

tell application "Music"
	if mute = true then
		set mute to false
	else
		set mute to true
	end if
end tell

playpause script that throws the error:

tell application "Music"
	if (playpause) = true then
		set playpause to false
	else
		set playpause to true
	end if
end tell

note that the compiler put the () parens around the command after the if statement, which I understand is correctly formatted. Just stating for clarity since the mute property doesn’t require them.

suggestions welcome.

According to the dictionary, playpause is not a property, setting or variable but a verb. i.e. a command. SO you don’t set playpause to a boolean, you just use the statement on its own and it will toggle the playing/paused state

tell application "Music"
	playpause
end tell

here is what you were probably trying to do using your logic

tell application "Music"
	local musicState
	set musicState to player state
	if musicState = paused then
		play
	else if musicState = playing then
		pause
	end if
end tell

thanks! much simpler, too.