Removing the - - when field is empty

I wish I could code but I can't. When using this script:"%artist% - %title% - %album% - $num(%track%,2)" Is their a way to avoid the - - when there is no album field (or an empty field). And secondly, is there a way to pick the albumartist (with priority to artist) if there is no artist field? Thanks a million.

If you enclose a field variable in square brackets, everything inside the brackets will only be output if the field is filled.
%artist% - %title%[ - %album%] - $num(%track%,2)

I think that something like this could work:
I would fill all the fields, though as non-existing information might lead to strange sorting results.

Thank you so much!!!