How to rename(reappoint) my file as follows without using the button of shortened

Hello, how to rename(reappoint) my file as follows without using the button of shortened num(%track%,2) ~ %title% ~ %artist% ~ %album% ~ %year% ~ %genre% but what if %albumartist% is different that %artist% then to rename(reappoint) the file as am num(%track%,2) ~ %title% ~ %artist% ~ %albumartist% ~ %year% ~ %genre% but that if the name of the album exists but that the artist and different that albumartist then to rename(reappoint) the file as follows num(%track%,2) ~ %title% ~ %artist% ~ %albumartist% ~ %album% ~ %year% ~ %genre%

Well I brooded some time about "button of shortened" but I still have no idea what you mean by this.
Anyway:
Use the Coverter Tag-Filenmame.
$num(%track%,2) ~ %title% ~ $if($eql(%artist%,%albumartist%),%artist%,%artist% ~ %albumartist%) ~ %year% ~ %genre%

Thank you for your answer but what is not exactly for what I looked.

I would like to have the name of file as follows

num(%track%,2) ~ %title % ~ %artist % ~ %album % ~ %year % ~ %genre %

But if artist and albumartist is different but if the album does not exist then named(appointed) the file as follows

num(%track%,2) ~ %title% ~ %artist% ~ %albumartist% ~ %year% ~ %genre%

But if artist and albumartist is different but if the album exists then named(appointed) the file as follows

num(%track%,2) ~ %title% ~ artist% ~ %albumartist% ~ %album% ~ %year% ~ %genre%

$num(%track%,2) ~ %title% ~ $if($eql(%artist%,%albumartist%),%artist%,%artist% ~ %albumartist%) $if($eql(%artist%,%albumartist%),"",$if(%album%,~ %album% ,))~ %year% ~ %genre%

When the artist, the albumartist is different without having of album he(it) names(appoints) me my file as that: num(%track%,2) ~ %title % ~ %artist %, %albumartist % ~ %year % ~ %genre%

It is very well.

When the artist, the albumartist is different aillant an album he(it) names(appoints) me my file as that: num(%track%,2) ~ %title% ~ %artist% ~ %albumartist% ~ %album% ~ %year% ~ %genre%

It is very well.

On the other hand:

When the artist, is equal by report(relationship) has the albumartist but when the album exists it names(appoints) me my file as that: num(%track%,2) ~ %title % ~ %artist% ~ %year% ~ %genre%

It is not good. He(it) should name(appoint) him(it) as that:

num(%track%,2) ~ %title% ~ %artist% ~ %album% ~ %year% ~ %genre%

The album misses(is lacking).

If you could help me to modify the code. In you thank.

This is your regexp.
$num(%track%,2) ~ %title% ~ %artist%$if($eql(%artist%,%albumartist%),,$regexp(%albumartist%,^(.+)$, ~ $1))$regexp(%album%,^(.+)$, ~ $1) ~ %year% ~ %genre%

That's exactly right. Thank you for your answers. Thank you also Florian with its ultra preforming software.