Search result and TC parameters

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
rust
Junior Member
Junior Member
Posts: 13
Joined: 2013-12-20, 07:24 UTC

Search result and TC parameters

Post by *rust »

This isn't really bug, I'd say it's TC specificity. In search result panel %P, %T return empty string, %N, %M return path\name.ext, %O returns path\name w/o ext.
Using MVV's TCFS2 tool, I make selection by partial name. When the cursor located on tc850x32_b12.exe file, I call selection dialog, then put %O, then send backspace twice, send star. All "tc850x32_b*" are selected.
If it isn't so hard, could you to fix %parameters work, please.
rust
Junior Member
Junior Member
Posts: 13
Joined: 2013-12-20, 07:24 UTC

Post by *rust »

"I do selection by partial name", of course :(
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I think %P doesn't work in search results panel because there is no single path there.

I don't understand where do you use %O... is it in button parameters? What does your button do in general?

BTW you may edit your posts. :wink:
rust
Junior Member
Junior Member
Posts: 13
Joined: 2013-12-20, 07:24 UTC

Post by *rust »

MVV, the idea is to select files like file01, file02... where differ last charachters (usually counter)
I use em_command, it calls selection dialog, inserts filename under cursor and removes last 2 characters.

Code: Select all

[em_selByPartName]
button=
param=/ef "tcm(3312,1) send(`{DQ}%O{BS 2}*{DQ}`)"
cmd=%COMMANDER_PATH%\addons\tcfs2.exe
Wow, there is Edit button, now I see it, thanks
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

OK, I see. You can use batch file between TC and TCFS2 that will extract filename from path, e.g. selbypartname.bat:

Code: Select all

@echo off
start "" "%COMMANDER_PATH%\addons\tcfs2.exe" /ef "tcm(3312,1) send(`{DQ}%~n1{BS 2}*{DQ}`)"
Add it to buttonbar, set parameter to %P%N and enable Minimized option to hide black window.
rust
Junior Member
Junior Member
Posts: 13
Joined: 2013-12-20, 07:24 UTC

Post by *rust »

Thanks, it works except names with spaces
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It works for all filenames for me. However dialog may appear after send function is executed so no keypresses will be sent to it, also dialog must not lose focus until keypresses are sent. You should use delay or wait_for and specify window class for send.

So, this one works for me:

Code: Select all

start "" "%COMMANDER_PATH%\addons\tcfs2.exe" /ef "tcm(3312,1) eval(delay(100)+wait_for(findwnd(`TCOMBOINPUT`), 5)) send(`{DQ}%~n1{BS 2}*{DQ}{ENTER}`, findwnd(`TCOMBOINPUT`))"
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

The behaviour of %P and %N is intentional: If the user specified only %N, it wouldn't work in the search result. Therefore %N has to contain the full path. If he specified %P%N, it wouldn't work if %P also contained the path, so %P must be empty. Similar problems when user uses %O.otherext or %P%O.otherext.
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:

Post by *DrShark »

My often use case is to open in the new tab the folder of the file under cursor in the panel with the search results, so it would be nice if at least a single %P would work in search results.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Post Reply