Repairing the scripts that the new iTunes version broke (again)?

I’m on Yosemite and not planning to upgrade further.
I have been avoiding updating iTunes as well because since version 12, it changed into something unbelievably difficult to use, jumpy, unpractical and ugly. Recently some native Apple apps were acting up by having their UIs disappear completely, and some sub-menu use problems, so I’d have to restart the application and start over. iTunes was among the bugged ones and I thought, okay, I don’t think it can change too much anymore can it, I updated to version 12.6.2.20 and – how textbook – my iTunes scripts are broken, again.

This is where it fails:

---Select and Play Playlist in iTunes
tell application "iTunes"
	set «class pMin» of front browser window to false
	set view of front browser window to playlist "Playlist name"
	set sound volume to 100
	play playlist "Playlist name"
end tell
---Toggle Shuffle On
tell application "System Events"
	tell process "iTunes" to if exists then
		click menu item "On" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar 1
		delay 5
		tell application "iTunes"
			set «class pMin» of front browser window to true
		end tell
		
	end if
end tell

It’s having problems with the object «class pMin», how do I talk to the new iTunes then?
I must admit, I have been so angry about the iTunes versions since 12, I might eventually take time to investigate how to downgrade way back and see if it works, but for now, I’d just like to restore what they keep breaking.

If my memory is right, you missed a step in the click instruction.

       click menu item "On" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1

ways if my

According to Script Debugger, the standard syntax for the instruction using «class pMin" is :

set type parameter info of front browser window to false

It’s the command whose shortcut is shift + cmd + M available in the menu Window.

Yvan KOENIG running Sierra 10.12.6 in French (VALLAURIS, France) mardi 12 septembre 2017 15:31:00

I replaced

and its true counterpart with :

and its true counterpart but the script still fails at the same line, highlighting it and coming up with

Did I miss something?

I replaced the click phase with what you suggested, too, but I don’t know if it works because the script can’t get over the browser window line and, the click phase actually used to work just fine up until now, I’ve only had an error message referring of the «class pMin» term.

Okay I managed to play around a little… The terms have changed. I didn’t manage to find out how to minimize the window so because “frontmost to false” doesn’t do the trick so I just emulated cmd+m. If I run this as an application, it does what it says on the tin.


---This piece of script was made to work in iTunes 12.6.2.20.
---This script Plays Playlist in iTunes on shuffle at full app volume, then minimizes it.
tell application "iTunes"
	set frontmost to true
	delay 3 --because if iTunes has to be launched, it has to load the library fully before commands
	set sound volume to 100 --because it might have been left at some other level
	set view of front browser window to playlist "Playlist Name" ---to address the next command to a specific playlist
set shuffle enabled to true ---to apply shuffle to that playlist
	play playlist "Playlist Name"
end tell
tell application "System Events"
	tell process "iTunes" to if exists then
		tell application "iTunes"
			set frontmost to true
		end tell
		tell application "System Events" to key code 46 using command down --cmd+M to minimize
	end if
end tell