Toggling "Onlyonce" (TC instance) by shortcut

English support forum

Moderators: white, Hacker, petermad, Stefan2

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 »

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: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

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

Post by *Horst.Epp »

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 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

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

Post by *ghisler(Author) »

You also have the /N parameter to open a new Total Commander even if OnlyOnce=1 is set.
Author of Total Commander
https://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 »

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: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

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

Post by *petermad »

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.
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.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
HerbieH
Member
Member
Posts: 145
Joined: 2003-02-11, 10:04 UTC

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

Post by *HerbieH »

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