And here’s a Shortcut that uses that AppleScript to rate the currently playing song. Because ratings are more-or-less deprecated, it also automatically “likes” ratings 4 and 5, and “dislikes” ratings 1 and 2.
https://www.icloud.com/shortcuts/f8856383bee247818ef72c1763aadb14