cmd.RunCommand("Go TABSELECT=$" + tab) doesn't keep items selected

If I add items to the cmd object, it only seems to work the first time I switch tabs.
If I switch to an empty folder.

What are you aiming to do?

Go TABSELECT doesn't use selected files/folders. It activates a folder tab.

Just like switching tabs with a mouse click, you won't lose your selection.
Maybe it's a problem with my script, I'll investigate later.

Found the reason, before switching tabs, you must Clears the collection of items.
cmd.ClearFiles();