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

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Galizza
Member
Member
Posts: 167
Joined: 2018-09-07, 05:21 UTC

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

Post 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 :!:
 
Last edited by Galizza on 2023-05-25, 13:59 UTC, edited 2 times in total.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: cm_exit Parameters suggestion

Post by *petermad »

Support+++
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
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cm_exit Parameters suggestion

Post 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.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: cm_exit Parameters suggestion

Post 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
Last edited by petermad on 2022-10-05, 12:01 UTC, edited 1 time in total.
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: cm_exit Parameters suggestion

Post 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.
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cm_exit Parameters suggestion

Post 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?
Author of Total Commander
https://www.ghisler.com
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Re: cm_exit Parameters suggestion

Post by *funkymonk »

It would also be great to have a parameter that allows to restart TC in admin or user mode...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cm_exit Parameters suggestion

Post 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.
Author of Total Commander
https://www.ghisler.com
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Re: cm_exit Parameters suggestion

Post 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?
User avatar
nsp
Power Member
Power Member
Posts: 1803
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: cm_exit Parameters suggestion

Post 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.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: cm_exit Parameters suggestion

Post 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 [..]
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
Galizza
Member
Member
Posts: 167
Joined: 2018-09-07, 05:21 UTC

Re: cm_exit Parameters suggestion

Post 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 :!:
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: cm_exit Parameters suggestion

Post 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
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
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cm_exit Parameters suggestion

Post 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.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: cm_exit Parameters suggestion

Post by *petermad »

I see that It also works on network shares, but not for virtual folders and FTP - but I'm very satisfied
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
Post Reply