Toggling "Onlyonce" (TC instance) by shortcut

English support forum

Moderators: Stefan2, white, sheep, Hacker

Post Reply
wiperr
Junior Member
Junior Member
Posts: 8
Joined: 2013-07-27, 16:33 UTC

Toggling "Onlyonce" (TC instance) by shortcut

Post by *wiperr » 2018-08-10, 11:52 UTC

Is there a way to toggle the "OnlyOnce=#" command by shortcut, while running?

I want to have only one window 'openable' by default, but also toggle the option for extra instance(s) without restarting.

Thanks.

User avatar
Horst.Epp
Power Member
Power Member
Posts: 2993
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Toggling "Onlyonce" (TC instance) by shortcut

Post by *Horst.Epp » 2018-08-10, 12:31 UTC

There is no internal command, so its not directly possible.
But whats the problem to allow more than one instance ?
Its useful to allow more than one instance to start a 2nd TC with enhanced rights in the current tree for example.
You also have the option to use the /o command line switch for all your ways to start TC.
So you never get more than one instance if you don't want it.
Windows 10 x64 Version 1803
April 2018 Update (OS Build 17134.191)
TC 9.21rc3 x64 and x86, Everything 1.4.1.907 (x64)

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36220
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Toggling "Onlyonce" (TC instance) by shortcut

Post by *ghisler(Author) » 2018-08-10, 15:40 UTC

You also have the /N parameter to open a new Total Commander even if OnlyOnce=1 is set.
Author of Total Commander
http://www.ghisler.com

wiperr
Junior Member
Junior Member
Posts: 8
Joined: 2013-07-27, 16:33 UTC

Re: Toggling "Onlyonce" (TC instance) by shortcut

Post by *wiperr » 2018-08-11, 12:43 UTC

Solved by mr Ghistler's one-line reply :) Exactly what I wanted.
by @Horst.Epp:
But whats the problem to allow more than one instance ?
I need a separate caller for an extra instance, which doesn't interfere with the original one
(which right now only restores an existing window)

Thank you.

User avatar
petermad
Power Member
Power Member
Posts: 7968
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: Toggling "Onlyonce" (TC instance) by shortcut

Post by *petermad » 2018-08-12, 14:29 UTC

which doesn't interfere with the original one
It sounds more like you need to run a second instance of TC that uses its own ini-file.

You could make a copy of your wincmd.ini file and call it for example wincmd2.ini. Then you can start a new instance of totalcommander with the /i parameter parameter like: path_to_tc\totalcmd64.exe /n /i=path_to_inifile\wincmd2.ini - then the second instance will use wincmd2.ini and all changes made in the second instance will not be recognized by the first instance - but of course you have to synchronize the two ini-files manually, when you make changes you want to apply to both instances like installing new plugins.

Another way is to disable "Options" -> "Operation" -> "Save on exit" -> "Directories" AND "Panels (brief/full, etc.)". Then your TC will always start in the same state with the same directories in the panels and tabs. If you want to change the start-up state, then make the changes and use "Cofiguration" -> "Save Settings" If you use this approach you can just start TC with the /n parameter - and the new instance will start in the previously saved state. I recommend this approach - that's what I use myself.
#524
Danish Total Commander Translator
TC 9.21rc3a 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit and TC 2.91b3 on Android 6.0
Get Extended Total Commander Menus

User avatar
HerbieH
Junior Member
Junior Member
Posts: 85
Joined: 2003-02-11, 10:04 UTC

Re: Toggling "Onlyonce" (TC instance) by shortcut

Post by *HerbieH » 2018-08-13, 22:43 UTC

Hello wiperr

You CAN toggle settings in TC's wincmd.ini file, that works without restarting TC.

Example:
I use 'Nircmd' by Nir Sofer to automatically change my wincmd.ini to make a .zip or .rar file file unpacked with or without the packed directory structure:

Code: Select all

nircmd.exe inisetval "%COMMANDER_PATH%\wincmd.ini" "Packer" "ExtractPathInZIP" "0" (..or "1")
This works right away!

- You can make two strings, that deals with your request:

Code: Select all

nircmd.exe inisetval "%COMMANDER_PATH%\wincmd.ini" "Configuration" "onlyonce" "0"
nircmd.exe inisetval "%COMMANDER_PATH%\wincmd.ini" "Configuration" "onlyonce" "1"
This is easily implemented as two 'em_[something]' commands in your 'Wcmd_eng.ini' file - or you can place them in two .bat (.cmd) files.
All can be excuted from within TC.
If it works like the ExtractPathInZIP command, the changes will take place immediately!

PS: A more skilled .cmd file creator could make a single 'toggle' file - using 'IF' to measure the state of 'onlyonce', and then change it to the other. :D
HerbieH*
-Keep on makin' music!

Post Reply