#1 2023-01-31 22:44

visusys
Member
Registered: 2021-10-16
Posts: 20

Feature Req: Built-In function that returns an array of all filenames.

In a similar fashion to GetMarkedFiles and GetAllFiles outlined here, I want to request that one or two additional built-in functions be added to the application.

This is just a suggestion with regards to function name, I don't care at all what it's named if you actually choose to add this:

GetMarkedFilenames
This function should return a TWideStringArray that contains the current "New Name" value for all files that are marked in the application.

GetAllFilenames
This function should return a TWideStringArray that contains the current "New Name" value for all files (marked or unmarked) in the application.

This would be extremely useful for serialization, to get around the kind of hack-ish approach now of saving all filenames to a temporary file and then reading it again. I can think of a lot of situations where this would be extremely useful.

Another request is a more powerful RegEx implementation, but I understand that would involve a lot of refactoring and deviation from the current state of the application so I'm not holding my breath there. I really do appreciate the addition of supporting lookaround now though.

Unfortunately some more advanced features just aren't there:

1. Variable-length lookbehind
2. Embedded lookbehind (or lookahead)
3. \K match discard (\K keeps the text matched so far out of the overall regex match)
4. There are more but I can't think of any off the top of my head.

I do think the addition of those two functions at the beginning of my post would be both very useful and probably not a nightmare to implement.

I really appreciate the consideration. And a big thank you for continuing to make ReNamer the most dominant and feature-rich bulk renaming utility on the market for windows.

Jay

Offline

#2 2023-02-07 00:51

jogiwer
Member
From: Germany
Registered: 2022-11-05
Posts: 66

Re: Feature Req: Built-In function that returns an array of all filenames.

Hi,
by now you would have to (and could) provide these functionality on your own (nearly):

  1. Maybe as first rule you could have an initialization block which ensures that there is a global var as TWideStringArray with the needed size (for all or marked). See also: HasGlobalVar, GetGlobalVar, SetGlobalVar and SetLength.

  2. Maybe as last rule you could store the computed new Filename into this array: get-store-set

  3. At other points of executed PascalScript you could access this global var as array and also a special index

  4. You might put all of this code block into functions and store them inside a file which you would in 1) first rule, 2) last rule and 3) where needed

Be aware that this approach won't recognize changes to the file list by adding or deleting files or by marking or unmarking them. Especially if the count doesn't change ... so you might use deprecated information.
Only solution to this might be to store all full-qualified filenames and compare them on the next run ...

Offline

Board footer

Powered by FluxBB