Empty Album Artist tags for compilations are actually how it should be, otherwise you break localisation (ie, hardcoded “Various Artists” will be wrong for any other language).
Plex now actually works with Various Artists compilations (ie no Album Artist) but it will tend to pick the wrong album artist from its database. You can change this manually with a SQL editor in the Plex db, which is way faster than editing all tags manually. It’s a one time thing, I’ve detailed it here: How do I prevent Plex agent from renaming AlbumArtist 'Various Artists' into 'Various'?
If you still want to do this workaround in iTunes, you don’t need scripts, make a smart playlist of tracks where “part of compilation” is true, and AA is empty. Select all, mass set desired tags, save. If you happen to have thousands of compilations, go to sleep because it’ll take hours.