Page 1 of 1

[Resolved] (TC 10.52 cm_exit 8: Always pass current paths) cm_exit to open a new instance with same directories

Posted: 2022-10-04, 20:00 UTC
by Galizza
 
Hi, i'd like to suggest a new parameter for cm_exit, will be similar to cm_exit 5 but without saving settings to wincmd.ini. Something like this petermad em_command that open a new instance with same directories and file position

Code: Select all

[em_ext_newcommander]
cmd=%COMSPEC% /C
param=%Z%X start "" "%%COMMANDER_EXE%%" /N /P /A /i="%%COMMANDER_INI%%" %P%N* %T%M*
menu=Open New Instance of Total Commander
button=%COMMANDER_EXE%
iconic=1
And if it is possible to implement the use of cm_RestoreSelection after Total restart would be great, thanks :!:
 

Re: cm_exit Parameters suggestion

Posted: 2022-10-04, 20:34 UTC
by petermad
Support+++

Re: cm_exit Parameters suggestion

Posted: 2022-10-04, 22:40 UTC
by ghisler(Author)
Could you please explain what would be the point of this? It wouldn't work well when using multiple tabs. In fact I tried this first before coming up with the parameter 4 - the problem was when the user switched tabs before closing, e.g. from tab 2 to tab 4, this command would then open the directory of tab 4 on tab 2 because the tab wouldn't be saved and would still be 2. But the current directory would be that of tab 4, which would be passed to TC via %P%N.

Re: cm_exit Parameters suggestion

Posted: 2022-10-05, 05:28 UTC
by petermad
You are right that it probably wouldn't work well with tabs, neither does my em_ext_newcommander command.

But I rarely use tabs, but often make changes to the .ini file manually and then use em_ext_newcommander,cm_Exit to restart TC with current dirs and cursorpositions as they were. I have disabled all auto-savings (exept Old command-lines) in the Operation settings, because I want my TC to otherwise to start in the same condition every time - so em_Exit 5 is not attractive to me.

People who want the latest tab changes transferred when using cm_Exit can use cm_Exit 5 - what I would like is a cm_exit 8 that tranfers current dirs and cursorpositions, but does NOT save anything to wincmd.ini

Re: cm_exit Parameters suggestion

Posted: 2022-10-05, 07:32 UTC
by Fla$her
Everything is right. Before restarting, we edit wincmd.ini to check the operation of some options. When autosaving, manual editing may not be remembered.

Re: cm_exit Parameters suggestion

Posted: 2022-10-05, 08:02 UTC
by ghisler(Author)
I agree that without tabs, -1 would be a valid option. But it breaks the option to add values, so maybe I should use:
8: Always pass current paths to the new instance with /P option
Then it could be combined with 1 or 2 too (start same or switch between 32/64 bit) and even with 4

What do you think?

Re: cm_exit Parameters suggestion

Posted: 2022-10-05, 09:30 UTC
by funkymonk
It would also be great to have a parameter that allows to restart TC in admin or user mode...

Re: cm_exit Parameters suggestion

Posted: 2022-10-05, 10:20 UTC
by ghisler(Author)
It would also be great to have a parameter that allows to restart TC in admin or user mode...
While it is possible to launch a program in admin mode from a program running in user mode, I don't know of any method to do the reverse.

Re: cm_exit Parameters suggestion

Posted: 2022-10-05, 10:44 UTC
by funkymonk
ghisler(Author) wrote: 2022-10-05, 10:20 UTC
It would also be great to have a parameter that allows to restart TC in admin or user mode...
While it is possible to launch a program in admin mode from a program running in user mode, I don't know of any method to do the reverse.
True. Hm, well, maybe just the one direction?

Re: cm_exit Parameters suggestion

Posted: 2022-10-05, 11:52 UTC
by nsp
ghisler(Author) wrote: 2022-10-05, 10:20 UTC While it is possible to launch a program in admin mode from a program running in user mode, I don't know of any method to do the reverse.
You could probably give a look to this blog entry. How can I launch an unelevated process from my elevated process, redux by Raymond Chen.

Re: cm_exit Parameters suggestion

Posted: 2022-10-05, 12:08 UTC
by petermad
ghisler(Author) wrote: 2022-10-05, 08:02 UTC I agree that without tabs, -1 would be a valid option. But it breaks the option to add values, so maybe I should use:
8: Always pass current paths to the new instance with /P option
Then it could be combined with 1 or 2 too (start same or switch between 32/64 bit) and even with 4

What do you think?
8 - sounds like a good solution - could you pass the paths as %P%N* and %T%M* not just as %P and %T - the * is necessary if the cursor is placed on [..]

Re: cm_exit Parameters suggestion

Posted: 2022-10-05, 12:29 UTC
by Galizza
petermad wrote: 8 - sounds like a good solution - could you pass the paths as %P%N* and %T%M* not just as %P and %T - the * is necessary if the cursor is placed on [..]
This is the best option and would be great to be able to use cm_RestoreSelection after restart, thanks :!:

Re: cm_exit Parameters suggestion

Posted: 2022-10-10, 21:03 UTC
by petermad
history.txt wrote:07.10.22 Fixed: CM_EXIT: Restore active panel with /P=L or /P=R switch, add 8 to parameter to always pass left/right path and name to the program (32/64)
Confirmed implementset in TC 10.52rc2 - even with preservation of cursor position. :D :D :D

Re: cm_exit Parameters suggestion

Posted: 2022-10-11, 06:48 UTC
by ghisler(Author)
It even works in archives, but only in the base level so far. In subfolders, the folder is restored, but not the file under the cursor.

Re: cm_exit Parameters suggestion

Posted: 2022-10-11, 11:37 UTC
by petermad
I see that It also works on network shares, but not for virtual folders and FTP - but I'm very satisfied