Command for reorganize/optimize .bar-file

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

Command for reorganize/optimize .bar-file

Post 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)
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
User avatar
petermad
Power Member
Power Member
Posts: 14810
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Command for reorganize/optimize .bar-file

Post by *petermad »

Or maybe just a parameter for the current command: cm_ButtonConfig 1
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6498
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Command for reorganize/optimize .bar-file

Post 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.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
TC 11.03 x64 / x86
Everything 1.5.0.1373a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.3 x64
User avatar
petermad
Power Member
Power Member
Posts: 14810
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Command for reorganize/optimize .bar-file

Post 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.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

Re: Command for reorganize/optimize .bar-file

Post 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.
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
Post Reply