Extract or open archive: unpackers selection & priority

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Extract or open archive: unpackers selection & priority

Post by *DrShark »

This suggestion does not touch unpacker selection or priority for "Find files" "Search in archives" feature because of
different use-cases which require different design. So for "Find files" "Search in archives" separate suggestion posted here.

This suggestion adds ability for users to select unpacker they want to use for extractig archive (or group of archives) and
also to (re)open archive with any unpacker, and even use ALT+F6 dialog on any file that not recognized by TC as archive using Enter or Ctrl+PgDn actions. As optional addition, for better usability I suggest also to divide all unpackers in dropdown list into groups (5 groups for "Extract files" dialog §1.3-1.7, and 2 groups for "(re)open with" dialog, see 2.3.1), details below. This suggestion doesn't change current "Enter" key, "Ctrl+PgDn" or "Alt+F6+Enter" hotkeys behaviour, so shouldn't cause problems with compatibility.

1. Extract files (Alt+F6) dialog; for one file extension:
1.1. Add a dropdown list of Unpackers (internal, external, WCX) similar to existing on in Pack (Alt+F5) dialog, but
instead of extensions like in Alt+F5 dropdown list, here we will use unpacker names. This dropdown list is designed to be
visible only if Extract files (Alt+F6) dialog called for one or several files with one extension. It will make possible to
use "Extract files" dialog for files that are not detected by Total Commander as archives neither by their extension nor by header. For better usability unpackers will be present in dropdown list by groups, with separate sorting inside each group.
This dropdown list is designed for using when TC has files with one extension selected in panel, but a simplified version of this dropdown list in theory may also be present if files with several extensions selected in panel, for this see §2.
1.2. In wincmd.ini in addition to [Packer] and [PackerPlugins] sections, another section have to be added for
§1.4 group of dropdown list. This section will contain custom unpacker priority for each allowed extension.
1.3 "Work with archive as with directory default unpacker". Here, for compatibility with current TC behaviour, we place one first unpacker that use "Open archive" (Enter, or Ctrl+PgDn key) for our extension. For WCX plugins Enter key defined by match our extension in [packerplugins] section in wincmd.ini, or Ctrl+PgDn key - they have 256 value there. For this unpacker in dropdown list we use default font color and "bold" style. If our archive(s) extension doesn't match unpacker for "Open archive" action, this item isn't present in "Extract files" dialog's dropdown list.
1.4. "Custom order for extension" group. Here we put unpackers present for our archive extension in our new wincmd.ini
section. For this group in dropdown list we use different font color ("Color1"), default style. Items in this group sorted by their # (see §4.) If our archive(s) extension doesn't match unpacker for "Open archive" action, this group isn't present in
dropdown list.
1.5 "Work with archive as with directory" unpackers group. Here we put all other unpackers except one (first in priority) used in $1.3, that can use "Open archive (either Enter or Ctrl+PgDn key) for our extension. For WCX plugins Enter key defined by match our extension in [packerplugins] section in wincmd.ini, or Ctrl+PgDn key - they have 256 value there. For this group in dropdown list we use default font color and "bold" style. If our archive(s) extension doesn't match unpacker for "Open archive" action, this group isn't present in "Extract files" dialog's dropdown list.
1.6. "Other WCXex w/ Detects archive type by content unpackers" group. Here we put only installed WCX plugins that
doesn't match our extension and have 64 value in [packerplugins] section of wincmd.ini. For this group in dropdown list we
use different font color ("Color2"), default style. Items in this group sorted by their order in [packerplugins] section of wincmd.ini. If [packerplugins] section of wincmd.ini doesn't have plugins that match requirements for this group, the group is not present in our dropdown list.
1.7. "Other installed unpackers" group. This group lists all other unpackers, including plugins, that don't match any of above groups. For this group in dropdown list we use default color, default style. Items in this group sorted by their order in Configuration dialog for external and internal unpackers, and then for their order in [packerplugins] section of wincmd.ini for WCX plugins. It seems that this group can always be present because at least the list of all or most of internal TC unpackers will be present here.

2. Extract files (Alt+F6) dialog; for several file extensions or files without extension.
Since here we have files that belong to different unpackers, in addition to dropdown list we may add checkboxes:
2.1. Checkbox "Try unpackers for Open archive action where possible". If checked, for each extension TC will try to use
unpacker defined for Open action (see §1.1). This checkbox can be active by default.
2.2. Checkbox "Try WCX plugins thet detect archive type by content". If checked, and checkbox from §2.1 also checked, TC will try this only for files where §2.1 will fail or can't be used. If checkbox from §2.1 unchecked, TC will try this for all selected files.
2.3. Checkbox "Try next unpacker for all files", with following our dropdown list. Here we can put all available unpackers, so user can try any unpacker for all selected files. Because here we have several extensions, sorting inside dropdown list probably won't give much benefit.
2.3.1. However, since chances to open file with unpacker from §2.1 or §2.2 criteria is higher, they may form a first group, and other unpacker will for second, with alphabet or natural sorting inside each. We also can divide dropdown list to alternative groups, with unpackers from Configuration dialog for external and internal unpackers being first, and then WCX plugins form [packerplugins] section of wincmd.ini, with sorting order from §1.7.
2.4. Below checkboxes and dropdown list, there are [OK] and [Cancel] buttons. If user deactivate all checkboxes, [OK] button became inactive.

3. (Re)Open archive with any unpacker.
For focused archive in panel, "Open with ..." action will be called using Ctrl+<somekey>+PgDn hotkey.
For for archive already opened in panel "Reopen with..." action will be called using Ctrl+<somekey>+PgDn on [..] element.
When action called, a dialog titled "(Re)Open with ..." appears. This dialog is also simplified version of one used in §1, without all extract-only-related items. So it will have just a dropdown list of unpackers from §1, [OK] and [Cancel]
buttons.

4. "Custom order for extension" wincmd.ini action design.
Since this section will match archive extension with unpackers already listed in wincmd.ini, I suggest to add unique ID for each unpacker (internal, external or WCX).
Then our custom order section will have next format:

Code: Select all

[custom order section name]
EXT=#,UID,name
ext - archive extension
# - number of unpacker for its order in dropdown list
UID - unique ID of unpacker.
name - custom name user want to see in dropdown list. If not present, TC can use something like INT:ZIP, EXT:ZIP for internal and external unpackers, and dll name for WCX plugins.
This way we can make a sorted list of unpackers for each desired extension.

5. Example:
Let's pretend we have next settings in wincmd.ini

Code: Select all

[configuration]
;new parameters for extract dialog dropdownlist colors, see §1.4, §1.5
unpackdialogfont1=blue ;Color1
unpackdialogfont2=green ;Color2
[packer]
InternalUnzip=1
UnZIP=c:\totalcmd\utils\zip\pkunzip.exe
intunzipuid=uidrandomnumber1
extunzipuid=uidrandomnumber2
PluginOverrideZip=1
[packerplugins]
ZIP=68,uidrandomnumber3,c:\totalcmd\plugins\powerfulzip.wcx
ZIP=4,uidrandomnumber4,c:\totalcmd\plugins\simpleunzip.wcx
SOMEEXT1=260,uidrandomnumber5,c:\totalcmd\plugins\multiunpackerzipsupport.wcx
SOMEEXT2=68,uidrandomnumber6,c:\totalcmd\plugins\someformatunpacker.wcx
SOMEEXT3=260,uidrandomnumber7,c:\totalcmd\plugins\multiformatunpacker.wcx
[new custom order section]
ZIP=1,uidrandomnumber6,multiunpackerzipsupport.wcx
ZIP=2,uidrandomnumber2
Calling Alt+F6 dialog on zip archive that has .ZIP extension will allow to select one of unpackers from dropdown list, in follownig order:
powerfulzip.wcx ;- §1.3 rule, PluginOverrideZip=1 counted
multiunpackerzipsupport.wcx ;- §1.4 rule
EXT:pkunzip.exe ;- §1.4 rule
INT:unzip ;- §1.5 rule
simpleunzip.wcx ;- §1.5 rule
multiformatunpacker.wcx ;- §1.6 rule
someformatunpacker.wcx ;-1.7 rule
This suggestion, with optional "order" thing, looks complicated, but when implemented it will be easy to configure and use.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This _should_ aready be possible by using internal associations: Define a new association for that file type, and then define an extra verb:
**ext
Use packer plugin defined for extension "ext" to view contents of file

For example, define an internal association for 7z and leave the "open" verb empty. Then define an extra verb, e.g. total7zip and set it to
**total7zip

And install total7zip associated with *.total7zip.

Then you can open the archiva via right click - total7zip.

I haven't tested this case yet, so please let me know whether it works for you or not.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

If someone uses multiple internal associations for different context menus it will be problematic to add such association for just single type because TC doesn't merge context menu items...
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Well, he could still add it to multiple internal associations if necessary.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I think it isn't a good idea to add a bunch of menu items to every IA template, and synchronize them on every change, or add them to a new IA template...
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

ghisler(Author) wrote:This _should_ aready be possible by using internal associations
Before writing a feedback a wanted to test it. However, I can't get it work using Ghisler's example. Using Total Commander Internal Associations configurations I can only add an extension, because the extra verb Total7Zip when entered into "Action(verb)" field (in Internal Associations->(Add or Edit)->New...->Edit file type window) doesn't actually saved by Total Commander after pressing [OK] buttons in "Edit file type" and then "Internal Associations" windows. So what I could get in wincmd.ini using menus (pretending I already installed Total7Zip plugin and associated it to "7z" and "Total7Zip" extensions in PackerPlugins section of wincmd.ini):

Code: Select all

[PackerPlugins]
7z=735,c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
Total7zip=735,c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
[Associations]
Filter1=*.7z
I suspect that it should be something like that:

Code: Select all

[PackerPlugins]
7z=735,c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
Total7zip=735,c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
[Associations]
Filter1=*.7z
Filter1_Total7zip=**Total7zip
but after I manually added this, new context menu item "Total7zip" on .7z archives does nothing.
I would appreciate for wincmd.ini example of correctly configured association.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

Ok, I found problems with my configurations.
1. Filter1_Total7zip=**Total7zip will work if:
a) only

Code: Select all

Total7zip=735,c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
present in [packerplugins] section of wincmd.ini.
In this case in archive properties after entering in archive using Total7zip menu we'll see "Packer: Total7zip".
b) if [packerplugins] will have:

Code: Select all

7z=c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
Total7zip=735,c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
Archive will be opened Total7zip menu item, and archive properties will show "Packer: 7z".
2. Filter1_Total7zip=**Total7zip will not work if:
[packerplugins] section will have:

Code: Select all

7z=c:\totalcmd\Plugins\wcx\Total7zip\badunpacker.wcx
Total7zip=735,c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
where badunpacker.wcx is some unpacker that either does not support 7zip or not configured properly to open them (like because of some dll dependency or wrong settings). With this configuration Total7zip menu item will not work.

3. Filter1_Total7zip=**Total7zip may or may not work if few packers registered to 7z extension in [packerplugins]:

Code: Select all

7z=735,c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
7z=735,c:\totalcmd\Plugins\wcx\Total7zip\badunpacker.wcx
Total7zip=735,c:\totalcmd\Plugins\wcx\Total7zip\Total7zip.wcx
This configuration is not supported by TC, since natively TC doesn't allow to add more than 1 unpacker to one extension, but still I tried it. It seems that TC in this case will try lowest entry for "7z" extension at first, and if it will fail Total7zip menu will not work. If lowest unpacker for 7z extension will not fail, it will be used on context menu "Total7zip" item, archive properties will show "Packer: 7z".

Summary: if we have next wincmd.ini configuration:

Code: Select all

[Associations]
Filter1=*.7z 
Filter1_Total7zip=**Total7zip
for "Total7zip" context menu item TC will use unpacker associated with Total7zip extension in [packerplugins] section of wincmd.ini only if 7z association not present in [packerplugins] section too. If association to 7z extension exists in [packerplugins] too, Total7zip context menu item will call unpacker for 7z extension, unpacker for Total7zip extension in [packerplugins] will be ignored.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

3. Filter1_Total7zip=**Total7zip may or may not work if few packers registered to 7z extension in [packerplugins]:
You can't have more than one entry with same name in INI section so its value is undefined.
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

MVV wrote:You can't have more than one entry with same name in INI section so its value is undefined.
Then a part of my suggestion from first post also won't work. For now I'll leave first post as is, later I'll edit it anyway because of currently implemented internal association feature.

2ghisler(Author):
ghisler(Author) wrote:For example, define an internal association for 7z and leave the "open" verb empty. Then define an extra verb, e.g. total7zip and set it to
**total7zip

And install total7zip associated with *.total7zip.

Then you can open the archiva via right click - total7zip.
1. Can you confirm that if [packerplugins] will have two different wcx plugins, one registered to 7z extension, and another to total7zip extension, and internal context menu configured like you suggested in above quoted example, Total Commander will use unpacker registered to 7z extension when internal context menu item "total7zip" used (to check, see "Packer" field of files properties inside 7z archive)? If yes, I consider it as a bug, since [associations] section, via **total7zip verb, tells TC to use unpacker for total7zip extension in context menu, and unpacker for 7z extension must be used only for Enter and/or Ctrl+PgDn actions.

2. In context of this topic too, but not related to mentioned above internal context menu feature. If confirmed as a wrong behaviour, I'll make a separate bugreport. So, in [packerplugins] register just single wcx, for 7z extension, configure it to be used only for Ctrl+PgDn hotkey, and not Enter, like that:
7z=260,c:\totalcmd\Plugins\wcx\7zip\7zip.wcx
I expected that in that case TC will use internal unpacker (listed as "7zip (dll) in "Packer:" field") for Enter key, 7zip.wcx (listed as "7z" in "Packer:" field) — for Ctrl+PgDn hotkey. However, 7zip.wcx plugin used for both Enter and Ctrl+PgDn .
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

If you open a file via **total7zip verb, TC should then use total7zip and not other unpacker defined for that extension.
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Hotkey assignation for certain WCX

Post by *DrShark »

What about adding a possibility to open file with certain WCX using hotkey alternative to Ctrl+PgDn? It could be integrated with current internal context menu system like that:
[PackerPlugins]
7z=C:\your\path\to\7z.wcx
total7zip=C:\your\path\to\Total7zip.wcx
[Associations]
Filter1=*.7z
Filter1_total7zip=**total7zip
[Shortcuts]
CA+ENTER=cm_SetAttrib
A+PGDN=Filter1_total7zip
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It would be much more backward-compatible to add some CM-command with parameter accepting packer plugin name... But even such a simple feature have not been added to TC yet...
Post Reply