How to convert this script to JavaScript?

Hi,

I use this AppleScript on the Mac, but I also need to run it on Windows. I cannot find any documentation on JavaScript for automation. I don’t have to script anything else on Windows, so any help converting this script would be very much appreciated.

PowerShell would also be good. I’m looking here to some ideas
https://learn-powershell.net/2013/12/19/exploring-itunes-using-powershell-part-1/
http://www.joshkunz.com/iTunesControl/main.html

This is a simple script to reset the rating of songs where the album rating was computed, and then the album rating was applied to the song

tell application "iTunes"
	set results to (every file track whose rating > 0 and rating kind is computed and album rating > 0 and album rating kind is user and media kind is song)


	log the number of items in results
	repeat with trk in results
		try
			set album rating of trk to 0

			-- logging
			set theAlbum to album of trk
			set theArtist to artist of trk
			log theAlbum & " by " & theArtist

		on error the the_errormessage number the the_errornumber
			display dialog "Error: " & the_errornumber & ". " & the_errormessage buttons {"Cancel"} default button 1 with icon 2 giving up after 15
		end try

	end repeat
end tell

this page has example JS code.
http://www.joshkunz.com/iTunesControl/interface__IiTunesEvents.html

Your going to have to convert yourself.

Other sites:
http://samsoft.org.uk/itunes/scripts.asp

Doug is the master with iTunes and AppleScript here’s his recommendations:
https://dougscripts.com/itunes/itinfo/windowshelp.php