Page 1 of 1

Command for reorganize/optimize .bar-file

Posted: 2023-07-22, 00:00 UTC
by LonerD
Now the only way to reorganize and clean .bar-file structure is calling cm_ButtonConfig (or cm_ButtonConfig2) command and then pressing OK in "Change Button bar" window.
Suggestion - new command that can silently do it without any windows (for using in scripts, for example)

Re: Command for reorganize/optimize .bar-file

Posted: 2023-07-22, 07:30 UTC
by petermad
Or maybe just a parameter for the current command: cm_ButtonConfig 1

Re: Command for reorganize/optimize .bar-file

Posted: 2023-07-22, 10:06 UTC
by Horst.Epp
I have a 3 lines main button bar with 150 buttons.
Just for interest, I haven't seen a reason to reorganize or optimize .bar files.
I always use the Button bar editor from the Ultra TC Editors.

Re: Command for reorganize/optimize .bar-file

Posted: 2023-07-22, 10:24 UTC
by petermad
2Horst.Epp
The need for reorganizing arises when you paste or delete buttons directly to the button bar via the bar's context menu. When doing that, the different parts of the button definition (buttonX, cmdX, paramX, pathX, iconicX, menuX) inside the bar file gets mixed up (button1 and iconic3 might come after each other). It is here that running cm_ButtonConfig and clicking OK fixes that, and rewrites the whole .bar file with item in "correct" order.

It is only a cosmetic thing inside the .bar file - it works just as well without reorganizing, but if you edit the bar file manually, it can be a nuisance if the items are out of order.

Re: Command for reorganize/optimize .bar-file

Posted: 2023-07-22, 12:36 UTC
by LonerD
petermad wrote: 2023-07-22, 07:30 UTC Or maybe just a parameter for the current command: cm_ButtonConfig 1
Parameter with bar name and path.
Or separate command like
optimizebar file_name
(similarly to openbar file_name)
petermad wrote: 2023-07-22, 10:24 UTC...when you paste or delete buttons directly to the button bar via the bar's context menu...
It is only a cosmetic thing inside the .bar file...
I came across this situation when I was making scripts to dynamically change and combine button bars. And it's not only cosmetic in this case. It would be much easier if all the keys in the file were organized in order beforehand.