Another useful thing I have setup in my Foobar is an artist field that I called "Combined Artist" in the Columns UI Playlist view. I vigorously fill in the Artist and the Album Artist tags in my songs and use them as they are supposed to be used. In my playlist I want them both to be visible, with the Album Artist tag being the main one and the Artist tag being kinda like a comment to it. And recently I decided I don't want to see the Artist tag if it is the same as the Album Artist. So here's what I came up with:

comp_config

The script is as follows:

$if($stricmp(%album artist%,%artist%),%artist%,[%album artist%] '('[%artist%]')')

What this does is it compares the %album artist% and the %artist% tags through the case-insensitive $stricmp comparison and $if it is true, just returns the %artist% tag. If the comparison evaluates to false, it returns a [%album artist%] '('[%artist%]')' string, which is basically just a Album Artist (Artist) format, but enclosed into [] which test the strings for being empty.

The result for when Album Artist is the same as Artist:

comp_same

And when they're not the same:

comp_not

Enjoy!