solved [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
petermad
Power Member
Power Member
Posts: 14809
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

solved [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *petermad »

I find problems with setting the new %COMMANDER_OPEN% environment variable for these locations:

lister: does not seem to work - pressing F4 in Lister returns edit.
unpack: only works when pressing Alt+F9 not when pressing F5 inside an archive.
- pack works with both Alt+F5 and F5 with open archive in target panel, so unpack should also work with F5.

em_commands does not work for bar and menu (but works for hotkey and cmdline).

see also: viewtopic.php?p=448908#p448908
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *ghisler(Author) »

I will check it, thanks. Please let me know if you (or anyone else) finds more cases.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *ghisler(Author) »

I have added a few more, please test!

Btw, you can test this also when just the editor opens:
1. Close all running copies of the editor
2. Open it with one of the methods you want to test
3. In the editor, go to the "Open file" dialog
4. Go to directory c:\windows\system32
5. Enter *.exe in the edit box and press enter
6. Type cmd in the list view to jump to cmd.exe. Don't press enter!
7. Right click or press Shift+F10 and then choose "Open"
8. Type the command
set
and press enter to see the environment variables.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14809
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *petermad »

history.txt wrote:31.01.24 Fixed: When opening a file with internal association set to * (opens context menu), set environment variable %COMMANDER_OPEN% to "opencontextmenu" (32/64)
30.01.24 Fixed: %COMMANDER_OPEN% was set incorrectly in Lister (F4), unpack with F5, em_command via menu, button bar, or view mode: auto-run command (32/64)
29.01.24 Fixed: The environment variable %COMMANDER_OPEN% wasn't set when opening a program from the directory hotlist, or the editor from multi-rename tool (32/64)
All of the above added or fixed in TC 11.03rc4 :-)

Using your recipe - I also managed to test changeini and editlistfile.
I cannot test new - On my tested systems (Windows 7 and 10) using Context menu, submenu "New" just creates a new file it does not open it in the. editor.

A couple of things
Opening from the Main menu and the Start menu both returns: menu - could that maybe be divided into startmenu and mainmenu.
Opening from the Horizontal bar and the Vertical bar both returns: bar could that maybe be divided into bar1 and bar2.
When using **path\file.bar in Internal associations it returns; bar - that could be kept, if bar1 and bar2 was supported.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *JOUBE »

Hey, please tell me, when is the environment actually full? IIRC, Previously[tm] there was a limit at 256 bytes then later at 1024 bytes.

Has this all been canceled and there is only a pointer in the real environment header of apps and scripts to an area with the strings?

Not that there is suddenly criticism from other apps - called within the Tc - whose own variables no longer fit. Because Tc added some more env variables with long names.

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

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *petermad »

2JOUBE
Hey, please tell me, when is the environment actually full?
At 32,760-characters I guess - see: https://devblogs.microsoft.com/oldnewthing/20100203-00/?p=15083

My current environment when running TC is 2658 bytes of which TC environment variables take up 287 bytes - so personally I have a long way to go to saturate the environment.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *JOUBE »

petermad wrote: 2024-02-02, 13:53 UTC At 32,760-characters I guess - see: https://devblogs.microsoft.com/oldnewthing/20100203-00/?p=15083
Thanks. Interesting: There it is called "environment block". So it is still a block in the app/script header of every currently running app/script. Wow, waste of memory...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *ghisler(Author) »

I cannot test new
The "New" submenu can create new files in various ways - some involve launching apps, some just create a file. It all depends on the content of the "ShellNew" registry key. It can be one of these values:
1. NullFile -> creates an empty file with the name chosen by the user
2. FileName -> copies template file from templates directory
3. Command -> run a command
4. Data -> create new file and fill it with data from that registry key

Only in case 3 an external program will be launched. Here only Google Docs (.gdoc) seems to do this.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14809
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *petermad »

Only in case 3 an external program will be launched. Here only Google Docs (.gdoc) seems to do this.
I don't have Google Docs, so somebody else must test this.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *ghisler(Author) »

Here is how you can test it:
1. Run regedit.exe
2. Go to the key
HKEY_CLASSES_ROOT\.txt\ShellNew
3. Click on "NullFile", press F2 and change the name to NullFile2
4. Right click on the right panel background
5. Choose New -> String
6. Enter name: Command
7. Set the value to:
c:\windows\system32\cmd.exe
8. In Total Commander, long right click on a directory background
9. Choose New -> Text file (.txt)
-> It should open cmd.exe
10. Use the command
set
to view the environment variables. Here this shows COMMANDER_OPEN=new
Revert the registry changes:
11. Rename NullFile2 back to NullFile
12. Delete the value: Command
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14809
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *petermad »

2ghisler(Author)
Using the above recipe I can confirm that %COMMANDER_OPEN% is set to new (Windows 7)

Moderator message from: petermad » 2024-02-05, 13:53 UTC

Moved to "TC fixed bugs" from "TC11.x bug reports (English)"
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: solved [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *ghisler(Author) »

Great, thanks a lot for testing it!
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14809
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: solved [TC 11.03rc3] %COMMANDER_OPEN% does not work for all locations

Post by *petermad »

history.txt wrote:06.02.24 Fixed: %COMMANDER_OPEN% didn't distinguish between F4 and Shift+F4. Set it to "editnew" for Shift+F4 and cm_edit /C, and to "editname" for cm_edit /N="name" (32/64)
Confirmed working in TC 11.03rc5 :-)
Last edited by white on 2024-02-08, 15:45 UTC, edited 1 time in total.
Reason: fixed quote
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply