Mutli-Rename Script v1.5c (Unicode)

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

Moderators: white, Hacker, petermad, Stefan2

User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Mutli-Rename Script v1.5c (Unicode)

Post by *majkinetor ! »

  • Notes ChangeLog

    v1.5c 19/02/2010
    • ! Fixed issue with content plugins that have - in the name (i.e. jpg-comment.wdx)
      + Optmization: Improved speed of editor preview a lot.

    v1.5b
    • + TCWdx module improved:
      • + Unicode support for TC content plugins - module will first try W export, then A export, then it will return error.
        + It cashes function adresses for faster subsequent calls. HTML manual for external use.
        * Removed dependency on folder names to be equal to content plugins names. When TC ini file is not present, module now searches recursively for all wdx files in the \plugins folder.

      * Range will no longer flicker in "select range" inputbox. Inputbox is wider.
      + Added TC content plugin cputil.wdx which allows to find file names with characters from a different code page, and rename them using conversion table.
      + ShellDetails.wdx updated to Unicode version.

    v1.5a

    • + Unicode support in GUI and AHK Plugins. Total Commander plugins are still not unicode (because they still mostly don't support it).
      + Resizable window (window placement is saved in ini)
      + Rename operation will create directory if it doesn't exist (__meta__)
      + If you hold CTRL while using drag&drop or shell extension to add single folder, MRS will add its files instead.
      * Preset Save button and DropDown replaced with single editable ComboBox. To save preset write its desired name and press ENTER. To load preset select it from the list or type its name.
      * You don't need AHK anymore to run MRS. AHKL is included in the archive, renamed to MRS.exe so you don't have to install it. MRS.ahk itself is renamed to AutoHotKey.ini.
      + Optimization: 10% faster renaming.


    v1.1

    • * ComboX, HLink modules updated. This will fix ComboX issue where plugin buttons were drawn over it.
      + CTRL + A hotkey added to select all files in the list view.
      + Little gui improvements.
      ! Bugfix: Script freezing, mostly on Win7 & Vista.
      + New AHK plugin Sub: Extracts substring from file name from str1 up to the str2.
Last edited by majkinetor ! on 2010-02-19, 10:04 UTC, edited 17 times in total.
Habemus majkam!
User avatar
nsp
Power Member
Power Member
Posts: 1813
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

Fine !

One of the feature that is not present in TC is the collision step :
for a large number of files, some of the renamed files have the same resulting name.
Instead of only poping error or renaming the files. You keep all the file with collision and add a new column for adding a new renaming step.

Do you plan to add it in your renamer ?

Do you have any news of FavFolder3 ??
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

That is already in.

Files that produced the error will stay in the list so you can do with them whatever you want (delete them, make new rename action).

The point is that app is open source so you can change anything very quickly, including the appereance of it. You can add things to menus. Its AHK, meanng fast programming, so you can do it ad-hock, as soon as you envision it.

You can write your plugin in Notepad. For instance one of the thing often requested here is counter that is reset on each folder change. That plugin could be done, actually I already have it here.

So, anybody can change the app or write plugin as he sees fit. Editing of file names after renaming can be done with FileInfo plugin. You make your mask, then you do Preview and save it as FileInfo.txt (file which FI uses to map lines to files in list view). Then you edit this file as you see fit and use it in next renaming step. Little bit more complicated then in MRT but has some more options, as FileInfo is just another plugin so you can combine it with others, plus it can return file column only instead of entire line...


About FavMenu, Ill upgrade it soon so it can be used in Vista and Power Shell.
Habemus majkam!
User avatar
nsp
Power Member
Power Member
Posts: 1813
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

majkinetor ! wrote:That is already in.
For me also it's already in TC. with a nice usercmd and key and buton...;)

I will try to do my step by step renaming as all is there big THX ! (I've just to learn a bit of AHK)
majkinetor ! wrote:About FavMenu, Ill upgrade it soon so it can be used in Vista and Power Shell.
Hope it will be before TC 7.5 !
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

I've just to learn a bit of AHK
Almost anything you could need except some extreme cases can be done in AHK in few lines of code. That makes AHK plugins better option than dll's.

With several hours to learn AHK basics and by browsing the AHK forums, I beleive anybody can do most of the things it want.

The difference between MRS and MRT is also in that you can use it from any place (OpenSave dialogs, Explorer, any other file manager). And Undo data persist between program and computer restarts. You can equaly easy create multi level undo etc... One other important thing is that you can add frequent renaming presets directly into the TC menu (by setting command line). MRS will not even open, it will just present progress bar. I keep "replace dots and undrscores" preset direclty in TC menu.

Its just imagination now.
Habemus majkam!
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

There's already scripting support in MRT. Script.wdx.
User avatar
nsp
Power Member
Power Member
Posts: 1813
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

m^2 wrote:There's already scripting support in MRT. Script.wdx
Nope scripting with wdx is only limited to filename not to MRT usage. (like the basic idea of ahk plugin in MRS )

As M. Ghisler never respond on dynamic wdx fields parameter idea. that would be very usefull to restrict content extraction ..... this is already a way to have one more step with MRS...


But the main point is that it is "OPENSOURCE" the code seams readable and we could ehance almost anything.... this should be start of a renaming framework with "enhancement points" and topic oriented plugin....

- additional toolbars
- additional menu
- info elements (wdx,ahk),
- stepper (having smth more structured than old -> new)
- filtered pattern like dynamic column for SuperWdx,
...

All those could have been in TC 7.x or 8.y but will not !
TC is not opensource, and CG is not our personal developer, he maintain TC for all usage and have some very closed idea on TC extension and automation

BUT also comes the problem of Performances, and that in 95% of our case MRT is sufficient and very well maintained ;)

--edited for readability
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

nsp wrote:
m^2 wrote:There's already scripting support in MRT. Script.wdx
Nope scripting with wdx is only limited to filename not to MRT usage. (like the basic idea of ahk plugin in MRS )
What do you mean?
AFAIK it works w/out issues in MRT.
nsp wrote:But the main point is that it is "OPENSOURCE" the code seams readable and we could ehance almost anything.... this should be start of a renaming framework with "enhancement points" and topic oriented plugin....

- additional toolbars
- additional menu
- info elements (wdx,ahk),
- stepper (having smth more structured than old -> new)
- filtered pattern like dynamic column
IMO the the most important is that it's free, but I get your point.
User avatar
nsp
Power Member
Power Member
Posts: 1813
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

m^2 wrote:AFAIK it works w/out issues in MRT.
Yes it works in MRT but it is limited as all other wdx plugin by TC calling convention. TC Call the plugin and the returning string is replaced by TC ... No interaction, no additional renaming step, no context...

MRT is also free for all that paid TC.

I'm a BIG fan of TC because I've spend a little money on it be a lot of time to custom it, adapt it with TCBL and powerpro. None of the file manager i've tested let me do stuff as fast as i do it with TC+TCBL+powerpro (the only one i like i D.Opus but it is twice expensive as TC) ..

It could be better if we could get support or clear answer and good reason for enhancement suggestion ignored by the author.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

nsp wrote:
m^2 wrote:AFAIK it works w/out issues in MRT.
Yes it works in MRT but it is limited as all other wdx plugin by TC calling convention. TC Call the plugin and the returning string is replaced by TC ... No interaction, no additional renaming step, no context...
I can't think of any case where any interaction other than "Give me a string for this file" call would be useful.
Context? Is a plugin supposed to return different strings depending on where you put it?

I don't know what do you mean by additional renaming step.
User avatar
nsp
Power Member
Power Member
Posts: 1813
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

m^2 wrote:I can't think of any case where any interaction other than "Give me a string for this file" call would be useful.
basic idea is exactly this exept that it could also be for a group of files or from the result of another wdx plugin...
m^2 wrote:Context? Is a plugin supposed to return different strings depending on where you put it?
Not exactly but it can ask parameters only once per renaming/search session by File type... and give default value when used as column. (without having to have a new dedicated entry point)
m^2 wrote:I don't know what do you mean by additional renaming step.
MRT and MRS allow two renaming steps :
1) for all files replace Name by [Expr], Extension by [Expr]
2) from the previous result, find/replace some pattern by replace string.

But I miss sometimes a round or two to accomplish what i want specially with regexp, ex change all .bat to .cmd, all .cpp by CC, all ^#TEXT#([^\.]+).doc$ by $1.txt ..... from the same list of file.

I know that i can do it but i have to open MRT more than once and/or have file renamed with "temporary names"
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

OK, I see your points. That's indeed better.
_meta_
Junior Member
Junior Member
Posts: 34
Joined: 2006-11-14, 08:04 UTC

Post by *_meta_ »

Nice,
but I miss the thing I miss the most in MRT, and that is the possibility to create directories...

--edit--
can be patched with this:

Code: Select all

;-------------------------------------------------------------------------------------
; Function: DoRename
;			Rename files using current processor
DoRename(){
	local newName, oldPath, newPath, dir, cnt, res, delRow := 1, flags := 0, dire,ext,name_no_ext

	if (gParseError) 	{	
		MsgBox Mask Error.
		return
	}

	SetWorking( true )

	FileDelete, %gResultList%

	Gui, ListView, lvFiles
	GuiControl, -Redraw, lvFiles
	cnt := LV_GetCount(), res := 1, Progress(true)
	loop, %cnt%
	{
		#flag := "real", #no := A_Index +  delRow - 1,  LV_GetText(oldPath, delRow, 3),  newName := Proc( oldPath )
		SplitPath, oldPath, ,dir
		newPath := dir "\" newName
;; PATCH by me
      SplitPath, newPath, name, dire, ext, name_no_ext
      IfNotExist, %dire%
        FileCreateDir, %dire%
;; End patch
		res := DllCall("MoveFileEx", "str", oldPath, "str", newpath, "uint", flags)
		if !res 
			LV_Modify(delRow, "col5", ErrMsg() ), delRow++
		else {
			LV_Delete(delRow)
			FileAppend, "%oldPath%" -> "%newName%"`r`n, %gResultList%
		}

		Progress_Inc()
		if !mod(A_Index, 10)			;do win messages
			sleep, -1
	}
	Progress(false)
	GuiControl, +Redraw, lvFiles 
	SetWorking( false ), Preview()		;call preview in case of errors
}
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

Ye, I wanted to that :) Thx. Ill add it to the next release when it happens.


The main differences between MRT and MRS are:

1. MRS plugins can accept parameter. For instance FileInfo.5 returns 5th column from the CSV file. You can also set delimiter.

2. MRS has scripting support, while MRT doesn't. You can use script.wdx tho, but I don't like VBScript, nor anybody else serious enough.

3. MRS can be used outside TC, you can integrate it in Explorer or any other file manager.

4. You can extend its button menus.

5. Undo works any time (after closing or restarting) and you can easily creatre multiple undos (few lines of code)

6. Interface is much better. The interface, actually, is one of the primary things I don't use MRT. It simply makes me insane.

7. You can double click the file and see the range construction real time. Instead of the selection that you must set in MRT, you can only set the cursor to get [N x- ] range which makes much more sense as file names are not the same lenght. In MRT you must always edit the result afterwards.


Initialy I wanted to create app that can chain multiple presets on file list and execute them all. I didn't do it so far, as I didn't have time to create interface for it. However, it can be programmed in an hour or two. Its usualy much easier to create multiple paterns that transform file list to something else, then to create 1 pattern to do it (or constantly reload).

Ie:

fileList - P1 -> P2 -> ... Pn -> filelistOut

I gues this is the same that nsp ment:
I know that i can do it but i have to open MRT more than once and/or have file renamed with "temporary names"
I don't know how it turned out this way, cuz that was the MAIN thing i wanted to do when i started :)

And the code is indeed well done. I was commenting every thing and was taking into account that it will be read and changed by others. Everything is modularised and you can quicly plugin/out anhything. I am glad somebody already posted improvement :)
Habemus majkam!
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

2. MRS has scripting support, while MRT doesn't. You can use script.wdx tho, but I don't like VBScript, nor anybody else serious enough.
Use vbs to run AHK.
Post Reply