Partially Usage of RedirectSection

English support forum

Moderators: sheep, Hacker, Stefan2, white

HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Partially Usage of RedirectSection

Post by *HBB »

"RedirectSection" is very nice feature. Especially it is very convenient for multi-users.

In our company, I have prepared a "wincmd_common.ini" file for common usage. Each user's "wincmd.ini" sections refers to "wincmd_common.ini" except personal settings like history, tabs, ... etc. I have a problem in "Configuration" section (maybe in others). I want to redirect some user's "Configuration" values to the ones in "Configuration" section of "wincmd_common.ini". This seems impossible according to information in Help.

Please let me explain this problem in an example :

wincmd.ini :
[Configuration]
RedirectSection=\\Server\wincmd_common.ini
LanguageIni=WCMD_ANY.LNG
Mainmenu=WCMD_ANY.mnu
:
wincmd_common.ini :
[Configuration]
LanguageIni=WCMD_ANYOTHER.LNG
Mainmenu=WCMD_ANYOTHER.mnu
:
In this example, what is the priority of "LanguageIni"? Does TC consider the one in "wincmd.ini" (in other words WCMD_ANY.LNG)?

If not, To Ghisler (as a feature request) :
May RedirectSection=2 (as a new definition) by the AlternateUserIni cause the following : "RedirectSection is valid for only the values which is not defined in current section."

Thanks...

Red ones >>> Edited.

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Why wouldn't you just copy the default settings in your wincmd_common.ini (as wincmd.ini) to the relevant user's directory/folder when setting up their UserName?
(Or a batch script to do so for existing accts).
And set the redirect section in wincmd_common.ini to
[Configuration]
RedirectSection=%USERPROFILE%\TotalCMD\wincmd.ini
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.

HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Post by *HBB »

Balderstrom, thank you very much for reply.

"wincmd_common.ini" is on our server and read only to all users except me (because of virus protection). When I change a value in "wincmd_common.ini", the users just start to use those changes in their TCs. Since the users are not so experienced about TC, I prefered this usage.

To copy common settings to the user's machines is a litlle bit difficult for each change. My way seems to be easy according to me.

Unfortunately, the users prefer our native language in TC when I prefer english. Edited >>> Note that the users run TC over server too.

Regards

HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Post by *HBB »

When I read my post again, I see that my explanations may not be enough. Please let me to clarify the situation as follows :

TC's program directory and "wincmd_common.ini" are on our server and read only to the users except me. The users run TC as follows :
\\Server\...\TotalCmd.exe /I=\\Server\...\wincmd_common.ini

"wincmd.ini" is on my PC. I run TC as follows :
\\Server\...\TotalCmd.exe /I=P:\...\wincmd.ini

Some sections in "wincmd.ini" refers to "wincmd_common.ini" on server. By this way I can change common settings in "wincmd_common.ini" except [configuration] section.

Regards

User avatar
MVV
Power Member
Power Member
Posts: 8503
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I recommend you to add following INI option:

Code: Select all

[Configuration]
UseIniInProgramDir=7
AlternateUserIni=%USERPROFILE%\Local Settings\Application Data\Ghisler\wincmd.ini
into your wincmd_common.ini and rename it to wincmd.ini. TC started w/o any command line will always use wincmd.ini placed in its folder if UseIniInProgramDir is set. So, you should tweak only general options in wincmd.ini on server, any other will be saved in alternate ini-file in user's profile.
Read more about RedirectSection and AlternateUserIni in help file, there is an information which sections not redirected and how to redirect or not redirect specific section of wincmd.ini.

HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Post by *HBB »

MVV, thanks for your suggestions. I had done a similar version of your suggestion.

I had added an AlternateUserIni=PathInPC\wincmd.ini into "wincmd_common.ini". PathInPC is a standart path for each user's machine for personel settings. My "wincmd.ini" also is in the PathInPC. This had solved most of the problems except the values in Configuration section.

Since RedirectSection can be only used in main "ini" file, Values in Configuration section can not be shared (note that AlternateUserIni is not meaningfull in redirected "ini" file).

Currently, while the users (except me) use the Configuration Section in "wincmd_common.ini", I use the Configuration Section in my own "wincmd.ini". When I want to change a value in Configuration section, I do it in both "wincmd.ini" and "wincmd_common.ini".

Thank you...

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

I can think of another way you could accomplish some of this, with ENVironment variables.

So if you have:
[Configuration]
LanguageIni=%WCMD_LANG%
Mainmenu=%WCMD_MENU%
You would have a LaunchTC.cmd file within TC's ProgramFolder that has:
@ECHO OFF
SET WCMD_LANG=WCMD_ANYOTHER.LNG
SET WCMD_MENU=WCMD_ANYOTHER.MNU
START "" TOTALCMD.EXE
Create a shortcut of LaunchTC.cmd, Propogate said shortcut to your Users, likely in the All Users\Desktop or such. All Users should likely be a roaming profile and on the server and not the individual machine?

I don't know if this idea helps or not, but it is a way for you to share the exact same wincmd.ini file, all you would do, is use a different LaunchTC.cmd that sets different values for WCMD_LANG and WCMD_MENU.

As I mentioned in another thread specifically regarding how to SET ENV variables, such a .cmd shortcut can have it's Icon changed to TC's instead of the generic .cmd program icon.

HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Post by *HBB »

Balderstrom, Unbelieveible :D . I did not expect to use environmental variables in "wincmd.ini".

Tomorrow, I will try them immediately. I think this may solve the problem and the other problems that I didn't mentioned here.

This is a new opinion for me. Really thank you very much...

Note : In fact, this is a third party solution. I always prefer an internal solution.

HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Post by *HBB »

Balderstrom, thank you very much for "great" hint 8)

I tried it and it worked perfectly.
The problem is solved for the language.

Best regards

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Excellent :)
I had been using ENV vars for much more mundane reasons. Sometimes after an Windows reinstall my Username/paths would change and I'd have to edit various .ini files and other settings. Using ENV Vars in wincmd.ini (and Button.bar's) generally limited the number of manual edits those files needed to be fixed afterwards.
Env vars were also the solution for Notepad2's problems with TotalCommander's ever present cursor.

HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Post by *HBB »

Balderstrom,

Env variable for language (LanguageIni=%WCMD_LANG%) had worked succesfully. But when I tried it for ShowHiddenSystem, it did not worked.

Wincmd.ini :
:
ShowHiddenSystem=%WCMD_SHS%
:
I tested the variable %WCMD_SHS% with echo + pause in a batch file before executing TC, I saw it gets value properly.

Do you have any idea why it does not work?

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

The only thing I can think of, is that particular option is togglable within TC. It is likely not evaluating the ENV variable on purpose, as you can easily enable/disable hidden|system files with a TC command -- which may even be among the default WCMD_ENG.MNU file.

I know I have it in my custom "View" menu.

And you don't need to do the echo/pause bit. You can launch a CMD window from TC, and type SET
All the ENV variables you create prior to launching TC get inherited into it's ENVironment -- as such those variables are also passed into any CMD windows (or programs) that you launch from TC.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.

HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Post by *HBB »

Thank you very much for quick reply.

Unfortunately, since I have an unfamilier usage for TC, I prefer to set the variables before runing TC.

Thanks again for new hint to show ENV variables :)

Best wishes

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

GSAR (General Search And Replace) is prolly what you need in this case, or FART (Find And Replace Text).

Download GSAR and place into the PATH somewhere, and put one of these into the TCLaunch.cmd file.

Code: Select all

IF "%USERNAME%"=="MasterOfTC" GOTO:_KeepHidSys
IF "%USERNAME%"=="JackOfAllTrades" GOTO:_KeepHidSys
REM ETC
gsar -i -o -s"ShowHiddenSystem=1" -r"
ShowHiddenSystem=0" "%ProgramFiles%\TotalCMD\Data\wincmd.ini"
)
:_KeepHidSys
REM More Batch File Goodness Here
OR

Code: Select all

IF NOT "%USERNAME%"=="MasterOfTC" (
	gsar -i -o -s"ShowHiddenSystem=1" -r"
ShowHiddenSystem=0" "%ProgramFiles%\TotalCMD\Data\wincmd.ini"
)
Although it might be worthwhile to take a look at TC's ignorelist.txt and add some files to that, change which file TC looks in for the Ignore List in the starting batch file with GSAR or the like.

HBB
Senior Member
Senior Member
Posts: 295
Joined: 2008-05-05, 21:31 UTC

Post by *HBB »

Balderstrom, thanks (again)^2 for hints GSAR & FART. They are the utilities that I need for a long time. :)

Unfortunately, I can not use them in my case, because wincmd.ini is read only for the users (except me) in our company as I explained above.

Anyway, I will try to find other possibilities to solve the problem. Thanks for your interest and helpfull hints in this topic. I have learned a lot of things here.

Regards

Post Reply