Can you add a cm command to restart TC?

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Can you add a cm command to restart TC?

Post by *Fla$her »

2petermad
There is a big disadvantage in your solutions β€” the lack of waiting for the program to close, which as a result causes a number of conflicts for resident modules (Autorun + ShellExecute, TWinKey > Miscellaneous > Startup Sequence).
It is also important to consider the architecture of the system for compatibility.
There is another important point that I implemented in my other old code: returning to directories that were opened in partially blocked tabs. But these are the details that are important to me and some other users.
Overquoting is evil! πŸ‘Ž
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Can you add a cm command to restart TC?

Post by *petermad »

the lack of waiting for the program to close, which as a result causes a number of conflicts for resident modules (Autorun + ShellExecute, TWinKey > Miscellaneous > Startup Sequence).
I don't have any of those running, so I cannot test it. But you can put in a wait periond (cm_Wait 500) before cm_Exit maybe that can help? It will change the instance number of the running TC though.
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
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Can you add a cm command to restart TC?

Post by *Fla$her »

petermad wrote: ↑2022-10-02, 14:17 UTCI don't have any of those running, so I cannot test it.
Just take my word for it. I have devoted enough time to this in my time.
petermad wrote: ↑2022-10-02, 14:17 UTCBut you can put in a wait periond (cm_Wait 500) before cm_Exit maybe that can help?
Under different conditions, a small delay is not suitable for a universal restart, therefore, in my code there is a waiting for the process to complete.
petermad wrote: ↑2022-10-02, 14:17 UTCIt will change the instance number of the running TC though.
On the contrary, the instance number will correspond to the last one that was completed.
Overquoting is evil! πŸ‘Ž
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Can you add a cm command to restart TC?

Post by *Horst.Epp »

Whats the reason for swapping the TC version instead of running both versions in parallel
if the x86 version is needed ?
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
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Can you add a cm command to restart TC?

Post by *Fla$her »

2Horst.Epp
First of all, the reason is the lack of need to keep several subprocesses and avoid conflicts between them.
As a rule, the user does not need an instance with another of the architectures, if everything suits him. However, for experiments and problems related to memory, the presence of plugins or programs that do not support compatibility, we have to temporarily resort to a different architecture.
Overquoting is evil! πŸ‘Ž
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Can you add a cm command to restart TC?

Post by *petermad »

2Fla$her
On the contrary, the instance number will correspond to the last one that was completed
I meant with my solution and adding cm_Wait - not with your solution
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
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Can you add a cm command to restart TC?

Post by *monarch-lfv »

2Fla$her
Thanks for the script AutoIT, but I have TCIMG (it's defacto Autoit too) already.
I have the autorun plugin with some settings but haven't noticed any problems (solution by petermad).

2petermad
Thanks, this is what I need. Works faster than TCIMG.
But I didn’t understand why the second instance of the program starts first, and then exits the first one? What's wrong with this code?:

Code: Select all

cm_Exit, em_othercommander
This works, because the list of commands must be completed in full. For example delay:

Code: Select all

cm_exit, cm_wait 2000, em_othercommander
- Works, but the cursor locations in the panels are reset. That is, it is better not to turn on the delay, without delay - ok.

2Horst.Epp
I have a system Win7x64 (at home) Win10x64 (at work), I use TCx32, because I have repeatedly noticed bugs that lead to the crash TCx64, while the TCx32 worked fine. In general, I think that TCx32 is more stable. Also in TCx32 there are old necessary plugins that are not on TCx64.
TCx64 has other benefits, such as showing thumbnails of documents for 64-bit applications.
Sometimes I have to switch, I set it up for myself like this:
Alt + Pause - Restart TC
Alt +Shift+Pause - TCx32 <-> TCx64
It's convenient and very fast for me.
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Can you add a cm command to restart TC?

Post by *Fla$her »

petermad wrote: ↑2022-10-02, 22:48 UTCI meant with my solution and adding cm_Wait - not with your solution
Oh, I see. You wrote "though". ОК.

monarch-lfv wrote: ↑2022-10-03, 05:08 UTCit's defacto Autoit too
The algorithm itself is important, not the tool.
monarch-lfv wrote: ↑2022-10-03, 05:08 UTCI have the autorun plugin with some settings but haven't noticed any problems (solution by petermad).
It's not any settings that are important, but specifically the launch and termination of programs (+ /T Or /TT), the execution of commands (including registry editing) after the AutorunFinalizeSection directive.
Overquoting is evil! πŸ‘Ž
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Can you add a cm command to restart TC?

Post by *monarch-lfv »

2Fla$her
You're right, I don't have those options (+ /T Or /TT). But at the same time, I have several programs that start with the TC. But these programs are not closed when the total is exited (for what should the processor be loaded when the TC is restarted). Implemented like this:

Code: Select all

ShellExec "%COMMANDER_PATH%\Plugins\wdx\Autorun\Autorun_program.vbs"
That is, I give all the difficulties to scripts. There is also a separate script that kills all processes running from the %COMMANDER_PATH% directory (of course does not start with the Autorun).
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Can you add a cm command to restart TC?

Post by *Fla$her »

2monarch-lfv
I wrote about universality. I don't understand why run programs through a script that runs from autorun? Why is there an extra layer? And what kind of difficulties are you talking about?
A script that does something separate from the directive has nothing to do with the case.
Overquoting is evil! πŸ‘Ž
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Can you add a cm command to restart TC?

Post by *monarch-lfv »

Fla$her wrote: ↑2022-10-03, 08:26 UTC what kind of difficulties are you talking about?
There are features of launching some programs. Basically, these are utilities placed in the tray. That is, if the program is already running (it is in the tray and in processes), then its subsequent launch opens the main settings window (for example, XMouseButtonControl). Other programs, when restarted, display a dialog box warning that the program is already running (for example, Greenshot). And this is what I need to avoid. Therefore, in the script I do process tracking, if the process exists, then the launch is not carried out.
At the first start of the Total, all the applications I need are launched and are constantly in the tray. They do not depend on Total restarts in any way.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Can you add a cm command to restart TC?

Post by *ghisler(Author) »

The next Total Commander will support restart via command:
CM_EXIT 1
This will start TC with parameter /N after saving paths on exit (if this is enabled by the user). It will also pass parameters /i= and /f= for the ini files if they were passed to the running program. Anything else?
Author of Total Commander
https://www.ghisler.com
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Can you add a cm command to restart TC?

Post by *monarch-lfv »

2ghisler(Author)
Yes, if possible - restart with switch versions TCx32 <-> TCx64. Thank you!
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Can you add a cm command to restart TC?

Post by *Fla$her »

monarch-lfv wrote: ↑2022-10-03, 09:00 UTCTherefore, in the script I do process tracking, if the process exists, then the launch is not carried out.
That's what I'm writing about. What's the point of doing this in a script if you can do it without problems via autorun.cfg using ProcessExist?
monarch-lfv wrote: ↑2022-10-03, 09:00 UTCAt the first start of the Total, all the applications I need are launched and are constantly in the tray. They do not depend on Total restarts in any way.
This is just a special case.
But when we use portable TC, then in the process of its completion (incl. before disconnecting the portable device) on other machines, it is required to close the running resident processes as well.
In addition, there are situations when the same resident script is tied to the handle of the process being completed for interaction only with it. Accordingly, there is no point in leaving it working. I have enough of them.
Or there are situations when one or another program is compared with the architecture of TC process, respectively, when restarting, replacement with the appropriate one is required.
Last edited by Fla$her on 2022-10-03, 10:32 UTC, edited 2 times in total.
Overquoting is evil! πŸ‘Ž
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Can you add a cm command to restart TC?

Post by *Fla$her »

ghisler(Author) wrote: ↑2022-10-03, 09:12 UTCAnything else?
Yes:
Fla$her wrote: ↑2022-10-02, 13:04 UTCreturning to directories that were opened in partially blocked tabs.
If you do, it will be just wonderful! :P
Overquoting is evil! πŸ‘Ž
Post Reply