Scripting multiple commands on object

This is probably a very simple question but if scripting multiple commands together on an object, how do you keep it selected when the object changes?

Simple example:
Run BooleanUnion on two solids then MergeAllCoplanarFaces on the result.


! _BooleanUnion _Pause _MergeAllCoplanarFaces

Won’t work because the union results in a new solid so when the second command runs nothing is selected. I thought _SelPrev might do it, but it won’t presumably because the result is a “new” object.

SelLast should work in this case (haven’t tested)

Thanks! I knew it was something simple just couldn’t find the right command.