state of menu item problems

Hey everyone, I’m trying to sync my menu items state with the state of shuffle in iTunes,so its checked if shuffle is on and not checked if shuffle is off. This was my attempt but state kept coming up as a variable…

tell application "iTunes"
		if shuffle of (first playlist whose special kind is Music) is true then
			set  state of menu item "shuffle" to 1
		else
			set  state of menu item "shuffle" to 0
		end if
	end tell

I don’t have iTunes on my work comptuer here, but I think you would need to call the menu item by more detail. Like…

tell application "iTunes"
       if shuffle of (first playlist whose special kind is Music) is true then
           set state of menu item "shuffle" of menu "File" of menubar 1 to 1
       else
           set state of menu item "shuffle" of menu "File" of menubar 1 to 0
       end if
   end tell

nope, that doesn’t work…

thanks Jaques, works fine! for some reason i can’t run my program…its getting an error i have never encountered before…here is the log

[Session started at 2007-06-05 19:04:41 -0400.]
2007-06-05 19:04:42.827 Play MiniTunes[2899] An uncaught exception was raised
2007-06-05 19:04:42.827 Play MiniTunes[2899] *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (IBMenuView)
2007-06-05 19:04:42.828 Play MiniTunes[2899] *** Uncaught exception: *** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (IBMenuView)

Play MiniTunes has exited due to signal 5 (SIGTRAP).