Diesel Prefix in command customation

When I customise a command or call a selfwritten routine I usually prefix the call with:_select;$m=$(if,$(eq,$(getvar,cmdnames),),,\)_[command] (where [command] is replaced with the routine name or the function)
This way the routine (or command) is applied to the current selection (if anything selected) or the selection can be made after clicking the customized button.
This works in AutoCAD. Can this be made to work in Bricscad as well?

The idea of the conditional select is to always use the "Previous Selection set" within the routine or command
In the first part - depending on the selection state (wheater something is already selected or not) - the user will be asked to make a selection.
Then command is used with _P as previous selection set.
So the ^c^c will have to go for sure. as this cancels the active selection.

Example:
Say I'd like to array some items down with a default spacing but with an amount specified by the user.
When nothing is selected yet: I have to specify -ARRAY;\;R;\1;-2;
or -ARRAY;\\;R;\1;-2; when making a selection window.
When I already have selected the items I'd like to array prior to clicking the macro button you would use: -ARRAY;_P;;R;\1;-2;

By using the conditional select statement the macro handling becomes should become uniform.

Are you sure about your 'for sure' claim?
Almost all macros in the default.cui start with ^c^c and yet work with an active selection. To my knowledge ^c cancels an active command, not an active selection set. It is used twice because two (maybe even more?) commands can be active at the same time (one called transparently).
I have tested my suggestions before posting. Maybe you should test them as well.

You are right about the ^C^C part. Indeed in can be included. Thank you for pointing out. I guess I assumed ^c to be similar to the escape key.

I discovered that the select command works different in macro's than straight from the commandline.
Difference:
When applying the command having already something selected:
- from the commandline: it exits the command directly storing the previous selectionset correctly.
- from a Toolpalette button: discards the current selection and starting the select command as if no selection was made.
Thus NOT 'storing' the previous selection set.

Tried to use select as transparent command, (using ' ), but unfortunately not the desired result.

Any suggestions?
Or how would anyone make a macro or routine pickfirst compatible?