Is it possible to insert filename in internal association?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
jiangzhenjerry
Junior Member
Junior Member
Posts: 58
Joined: 2016-01-15, 23:57 UTC

Is it possible to insert filename in internal association?

Post by *jiangzhenjerry »

Hello all,

I'm trying to mimic 7-Zip's context menu items so that I can ditch 7-Zip's explorer DLL hook. This challenge problem came up when I try to insert the filename (without extension) into the internal association.

What's easy to accomplish: Let's say I want to create a context menu to extract the contents of a zip file to the current folder. The command is like " 7zG.exe x ABC.zip" So the internal association is as simple as:

Code: Select all

Filter1=*.zip
Filter1_7-Zip=7zG.exe x "%1"
What's hard to accomplish: 7-Zip ships with another context menu to extract the contents of a zip file to a new sub-folder of its name under the current folder. That is, to extract ABC.zip to a sub-folder named "ABC" under the current folder. The command is like "7zG.exe x ABC.zip -oABC" But I don't know how to insert "ABC" into the internal association context menu? I tried:

Code: Select all

Filter1=*.zip
Filter1_7-Zip=7zG.exe x "%1" -o"%O"
but apparently it doesn't work...

Does anyone know if it is possible, or if there is a workaround? Thanks in advance!
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: Is it possible to insert filename in internal association?

Post by *hi5 »

You might try a batch file? see Parameter Extensions @ https://ss64.com/nt/syntax-args.html
%~nx0 file name
%~n0 file name without extension
%~x0 file extension
you can call the batch with

Code: Select all

Filter1_7-Zip=%commander_path%\your_batch_file.cmd "%1"
Batch file something like:

Code: Select all

7zG.exe x "%1" -o"%~x0"
Also look at https://ss64.com/nt/start.html and

Scripting languages may work too such as AutoHotkey and no doubt others.
F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
jiangzhenjerry
Junior Member
Junior Member
Posts: 58
Joined: 2016-01-15, 23:57 UTC

Re: Is it possible to insert filename in internal association?

Post by *jiangzhenjerry »

hi5

Ah, I should have thought of this. Thank you sir :D
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Is it possible to insert filename in internal association?

Post by *Horst.Epp »

Why a context menu ?
Using a button should do it without any special batch or something in between.
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
jiangzhenjerry
Junior Member
Junior Member
Posts: 58
Joined: 2016-01-15, 23:57 UTC

Re: Is it possible to insert filename in internal association?

Post by *jiangzhenjerry »

Horst.Epp

Button is indeed more flexible. In this case, however, I have multiple uses of 7-Zip (open archive, extract archive to current folder, extract archive to a new folder, add file to an archive, open the current path in 7-Zip file manager...) If I create buttons for each of them, then I also need to create unique icons for each of them such that I can differentiate. Would be a headache unless I were an artist...
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6450
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Is it possible to insert filename in internal association?

Post by *Horst.Epp »

So you don't have 7z itself installed ?
This would provide all this context menu entries for files selected in TC.
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
jiangzhenjerry
Junior Member
Junior Member
Posts: 58
Joined: 2016-01-15, 23:57 UTC

Re: Is it possible to insert filename in internal association?

Post by *jiangzhenjerry »

Yep, that's what I meant in the first sentence of the my post. I don't "install" 7-Zip (or most other software applications), but instead just carry its key executives with TC. I am hoping to make TC fully portable in the way that it doesn't rely on DLL hooks for context menu items
User avatar
solid
Power Member
Power Member
Posts: 747
Joined: 2004-08-09, 11:20 UTC

Re: Is it possible to insert filename in internal association?

Post by *solid »

Why not using the built-in commands for working with archives?
You can do all you need, add/remove files or dirs from archive, extract some or all files, extract archive to folder with archive name of in the target panel folder etc.
User avatar
Gral
Power Member
Power Member
Posts: 1460
Joined: 2005-01-26, 15:12 UTC

Re: Is it possible to insert filename in internal association?

Post by *Gral »

2jiangzhenjerry
Just build dropdown menu on main manu using user commands. You can also use these commands in button subbar droped as a menu from main button bar (although here you can write commands and parameters directly)
Post Reply