[Req] Multy Rename Content plugin request

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

[Req] Multy Rename Content plugin request

Post by *Lev »

I would like to have a content plugin acting like a Multy Rename Tool, but without actual files renaming. I'd like it to send the result name to the content field. I think Christian has already all the needed code and it would be easy for him to write such a plugin. The only thing is to decide how to store/pass renaming parameters to the plugin. May be to use the plugin's ini file or to get last renaming parameters from the wincmd.ini, or to make some interface similar to the Multy Rename Tool...
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

Just curious: What shall that be good for?

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
van Dusen
Power Member
Power Member
Posts: 684
Joined: 2004-09-16, 19:30 UTC
Location: Sinzig (Rhein), Germany

Post by *van Dusen »

2Lev

This feature already exists in a limited manner: You can define substrings for custom columns:

Code: Select all

[=Pluginname.Fieldname.Unit:{substr params}]
Example 1 (will give you the first 20 chars of the path and the last 20 chars of the (full) filename, delimited by the literal " ... "):

Code: Select all

[=tc.Pfad:1,20] ... [=tc.Voller Name:-20-]
Example 2 (will give you the first character ("N" or "Y") of a "No" / "Yes" field):

Code: Select all

[=streams.HasStreams:1]
(Example 2 doesn't deal with filenames = useless example)

Probably not the full featured solution you have suggested...

Regards, van Dusen
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

2 sheepdogI want to sort files in a desired order without a real remnaming for example file1, fille10, file2 can be sorted in needed order and so on
2 van DusenThank you very much for the tip. I didn't find the tip about last letters of a field contents in the Help file. I think the help should be corrected.
User avatar
JohnFredC
Power Member
Power Member
Posts: 886
Joined: 2003-03-14, 13:37 UTC
Location: Sarasota Florida

Post by *JohnFredC »

I think I could use this feature.

Support.
Licensed, Mouse-Centric, moving (slowly) toward Touch-centric
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

2 van Dusen Unfortunately the column is sorted by it's unmodified parent

I've created 3 files:aaa037.txt, bbb105.txt, ccc005.txt and created a custom column: [=tc.name:-3-] (3 last letters) so I see only 037, 105, 005 as I want, but when I'm trying to sort files by the column result, they are sorted by unrestricted [=tc.name] order :(
Is it a bug or a feature?
User avatar
van Dusen
Power Member
Power Member
Posts: 684
Joined: 2004-09-16, 19:30 UTC
Location: Sinzig (Rhein), Germany

Post by *van Dusen »

2Lev
You are right... unfortunately TC always sorts by the full value. This is by design, as Mr. Ghisler wrote in this posting (on the german board).
My bad translation:
"Yes, sorting is always done by the full value. Reason: That way you can display substrings from numeric values too - but for sorting this would be rather inexpedient"

If you need a user defined sort order of files, you can use another workaround... I'll try to find the appropriate thread... stay tuned! :)

*** EDIT - Begin ***

I've found it: *click*

This solution may not meet your reqirement, because
* it doesn't use a substring of a given filename (as sort key)
* you can't select multiple files to apply ascending sort key for each file of the selection automatically
Maybe it's possible to modify the DOS batch to solve these problems...

*** EDIT - End ***

Regards, van Dusen
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

Thanks. I want to jump by folders with plugin enabled without starting any scripts/batches and without creating any file lists but I'll give it a try. Let's wait if Christian'll read this tread.
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

OK, I had to write myself a shortened, buggy version of a desired plugin - Regexp Content plugin. Hope it would be useful for anybody else. :)
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Hope it would be useful for anybody else.
The first usage for me is to add leading zeros to emulate SortUpper=2 so I can have both views at once. You should create a separate release thread with the next version, this plugin really deserves it!

Thanks! :)

Icfu
This account is for sale
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

Sorry, but I didn't understand what did you mean by "SortUpper=2" is it like in [file1->file01] section or something else?

PS there was a silent update after 67 downloads of a plugin, previous versions did not contain this section.
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Sorry, but I didn't understand what did you mean by "SortUpper=2" is it like in [file1->file01] section or something else?
Don't you know that INI-Setting? Look in wincmd.ini section of TC help.
Yes, it's file1 -> file01. With your plugin I can now have SortUpper=0 by default and have a separate column with "emulated" SortUpper=2 sort order. So, very useful for me.

Icfu
This account is for sale
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

Thanks for your explanation. There is a bug in a Help file, it is written: "2: Uses mixed lexical and numerical sorting, e.g. file10.txt comes AFTER file1.txt" instead of "AFTER file2.txt" (file10.txt comes after file1.txt with any sorting method), so I didn't understand the usefullness of that key and forgot about it's existance.

Note that [file1->file01] woud not work with files like file3.txt, file22.txt and file101.txt, it reguires another regexp, and I'm not a guru in their creation :(
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Yep, should read "comes AFTER file2.txt".

Regarding your plugin:
There is an EEDFADE exception when a non existing section is linked in [mrc].
Note that [file1->file01] woud not work with files like file3.txt, file22.txt and file101.txt, it reguires another regexp, and I'm not a guru in their creation
I am using two sections now:

Code: Select all

[mrc]
section=Add One Leading Zero
section=Add Two Leading Zeros

[Add One Leading Zero]
Find="(.+)\s(\d{2})$"
Change="$1 0$2"
Substitute=1
Others=1

[Add Two Leading Zeros]
Find="(.+)\s(\d)$"
Change="$1 00$2"
Substitute=1
Others=1
The problem here is that your plugin seems to ignore the second section so it doesn't work. Each of the sections work flawlessly when the other one is disabled.

Icfu
This account is for sale
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

Yes, as I wrote in readme - Very initial, very buggy :(
Plugin does not support several columns yet (there is a workaround written on a plugin page) and does not support several sections at once. (I wonder if any program can support an ini file with 2 keys in the same section with a same name)
I think a new combined regexp shoulld be written for adding leading zeros or a separate plugin which would be devoted only to this problem alone.
Post Reply