setting shuffle state based upon button

I’m trying to set whether Shuffle in iTunes is on based upon the status of an on/off button, heres my code:

if name of theObject is btnShuffle then
		set shuffleState to state of button "btnShuffle" of tab view item "tabMusic" of tab view "tabViewMain" of window "HarmonyMain"
		tell application "iTunes"
			if strUserPickedPlaylist is "" then
				set shuffle of playlist "Library" to shuffleState
			else
				set shuffle of playlist strUserPickedPlaylist to shuffleState
			end if
		end tell

However, I get a runtime error, claiming that the variable btnShuffle isn’t defined, which is odd because btnShuffle is a button!

Try changing…

if name of theObject is btnShuffle then

…to…

if name of theObject is "btnShuffle" then

j