Step 1:
Decide whether you want a Button to get your command going or a ribbon or both.
THIS WILL STICK TO A TOOLBAR BUTTON.
Step 2: Giving a name to your new command:
If you have toolbars on, click on an empty space on a toolbarline.
If you have the command lie on, type in _CUI.
The CUI opens. On the LEFTHAND side you will have two panels visible. The bottom one called "COMMAND LIST" will list all currently named (and defined) commands. Looking down you will have first a search panel, then a filter list, next to which there are two buttons. The righthand button will create a new entry in the list, called "command1". Edit it to the name of your command.
Step 3: Defining what your command will do:
If the CUI interface shows one column of panels only, click the button on the far right bottom of the CUI.
Make sure you have the new command name selected in the Command list. Then the right side of the CUI will give you all the possibilities to define and illustrate your new command. The "Macro" entry will open a small stringeditor allowing you to write a (small) macro that will be executed when the command is called. The editor is already preloaded with the obligatory escape codes preceding all menu commands.
If you remeber the old days where one would write screen menus or tablet menus grosso modo all syntax requirements are still valid in this string editor. In fact, this little editor replaces the functions of the MNU and MNX files.
If your command were to be calling a Lisp routine, the macro would be something like "^C^C(somefunc)" or if the LSP would contain a (defun C:somefunc one would write "^C^Csomefunc;"
Add the references to helpfiles you might have written, and the names of bitmapfiles you want to appear on toolbuttons or ribbons.
Step 4: putting the new command at the disposal of the user:
Here you decide from which source you want to present the new command to the user. Possebilities are: a panel in a tab in a ribbon, a button in a toolbar, an entry in a menu, an entry in a shortcut menu, or all or any off the above.
Display the TOPLEFT interface in the CUI.
You navigate within the treeview to the place where you want to be: Select toolbars, select a specific toolbar and display the contents of the toolbar.
Now in the command list, select the command name you just created and dragdrop it to the position in the displayed toolbar where you want it to be.
You may swap steps 3 and 4, however the order here presented seems moor logical.
Pressing Apply (on the bottom line of the CUI) will show your toolbutton in the appropriate position. Clicking the button will execute your new command
Be sure to save your changes. Make sure that the location of the bitmaps for the newly made button is listed in the file search path or a default question mark bitmap is shown.