wincmd.ini: Sort a list of settings in alphabetical order

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
misvin
Member
Member
Posts: 112
Joined: 2010-08-14, 11:25 UTC

wincmd.ini: Sort a list of settings in alphabetical order

Post by *misvin »

Hi,
Sometimes a user needs to edit manually the wincmd.ini file.
wincmd.ini includes dozens of sections with hundreds of lines (settings).
When Total Commander saves the changes made to the file wincmd.ini, it also changes the position of some sections and/or settings in wincmd.ini.

I suggest always to save all sections (with their relevant settings) in the alphabetical order (A-Z).

Example:

[1600x900 (8x16)]
CompareDivider=500
CompareDX=120
..............
FontName=Microsoft Sans Serif
FontNameDialog=Microsoft Sans Serif
.............
x=288
y=19

[Associations]
.....
[Colors]
ActiveTitle=8388608
ActiveTitleText=16777215
BackColor=-1
............
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

It would be nice, but I doubt it's possible. AFAIK TC just calls WritePrivateProfileString API function which does all the writing to the file; it's probably also responsible for moving whole sections within the file (not sure about that, but it's an educated guess).

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

misvin,
Here is a short AHK script that sorts the .ini file. Test on a backup first.

Code: Select all

#NoEnv

IniFileName = C:\Program Files\Totalcmd\wincmd.ini

IniRead, SectionNames, %IniFileName%
Sort, SectionNames, CL
Loop, Parse, SectionNames, `n
{
	IniRead, Section, %IniFileName%, %A_LoopField%
	Sort, Section, CL
	NewIni = %NewIni%[%A_LoopField%]`n%Section%`n`n
}
StringTrimRight, NewIni, NewIni, 1
FileDelete, %IniFileName%
FileAppend, %NewIni%, %IniFileName%
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
misvin
Member
Member
Posts: 112
Joined: 2010-08-14, 11:25 UTC

Post by *misvin »

Hacker wrote:misvin,
Here is a short AHK script that sorts the .ini file. Test on a backup first.
I have sorted manually all settings (thanks to Excel :-)) and saved the wincmd.ini file.
But next time when I run TC, the alphabetical order (A-Z) is corrupted because of [lefttabs] and [righttabs] sections, and because of other settings.

Please note that TC should be closed before I edit wincmd.ini.
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

misvin,
I have sorted manually all settings (thanks to Excel :-)) and saved the wincmd.ini file.
But next time when I run TC, the alphabetical order (A-Z) is corrupted because of [lefttabs] and [righttabs] sections, and because of other settings.
Yes, that's why the script can come in handy.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
misvin
Member
Member
Posts: 112
Joined: 2010-08-14, 11:25 UTC

Post by *misvin »

Hacker wrote:Yes, that's why the script can come in handy.
Can this script (or similar code) be implemented in TC official release?
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

misvin,
I don't think that such thing will be ever integrated into official TC release because it is not required for normal TC work, order of INI entries have no impact on TC work. I can only suggest to have such script somewhere and run it when you need to edit wincmd.ini if you really want to see entries sorted alphabetically (I prefer to see more important sections first, e.g. [Configuration]).
Post Reply