#1 2006-04-12 12:51

GilesKS
Member
Registered: 2006-04-12
Posts: 2

Renamer with names stored in a Text file

Hi Denis,

Renamer is a great program, I use it quite a bit. I've just downloaded v3.05, and love the new flexibility of being able to change the order of the rules.

I have a suggestion (actually 2) for a small change. That is, it doesn't seem possible to combine renaming using a text file and the rules - whenever I apply one it clears the other. Maybe that's just me doing it wrong, as this is the first time I've used the textfile option. But it would be quite handy to import names and then modify them in the usual way.

The second is whether any kind of a look up option be too complex to include. That is, selective replacement of text in the file name with text from a reference file.

Anyway, just my thoughts on ReNamer. Thanks again for a great program.

Offline

#2 2006-04-13 00:56

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Renamer with names stored in a Text file

At the moment, text files and the rules can not be combined, since new names from the rules are always re-generated from the original name, while new names from the text file are only for 1 go.

There is a simple workaround for that: once you've loaded you new names from the text file - rename your files, so they store that name, and after that - you can use rules for manipulating with those names wink

Hmm... I dont really understand the second suggestion... can you explain it in more details please?

By the way, you will be able to do (virtually) anything with your filenames, with a new RascalScrept rule, which is coming soon smile

Offline

#3 2006-04-18 21:46

GilesKS
Member
Registered: 2006-04-12
Posts: 2

Re: Renamer with names stored in a Text file

Hi Denis,

Yes, I see that in most cases the workaround would be fine. Although, if some of the new names in the text file were identical for whatever reason that would prevent that approach.

My second suggestion wasn't very important, but what I had in mind was the abitily to insert/replace text in the file depending on the content, with reference to an external table. E.g. if I had files containing the letters A, B & C, and a table relating each of those letters to some specific text, then I could replace and/or insert the text from the table depending on the original letter. I don't know if that's any clearer, but I'm not sure that it would have much use in general compared to the existing rules.

Offline

#4 2006-04-20 10:27

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Renamer with names stored in a Text file

Good news smile
You wanted to "combine renaming using a text file and the rules", and here is the rule that will do that: PascalScript, enter a code below into its field:

var I: Integer;
begin
  I := I + 1;
  FileName := FileReadLine('C:\names.txt', I);
end.

This will create a rule, which will read lines from 'C:\names.txt' file (which you can change to your file), and place them as the new filenames! After that, you can add any other rules... Tell me how it works for you, ok? And don't forget to download the latest dev build: ReNamerBeta.zip

About your second suggestion... I'm a bit confused, tell me more...

Offline

#5 2021-06-22 12:33

Lauraq
Member
Registered: 2016-10-02
Posts: 86

Re: Renamer with names stored in a Text file

I love this featured but I have a problem with the accented letters. à è ì ù ò are displayed (and renamed) with a question mark sad
Is possible solve this problem?

Offline

#6 2021-06-26 11:21

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Renamer with names stored in a Text file

Lauraq wrote:

I love this featured but I have a problem with the accented letters. à è ì ù ò are displayed (and renamed) with a question mark sad
Is possible solve this problem?


FileReadLine is ANSI encoding plain text only.


https://www.den4b.com/wiki/ReNamer:Pasc … ad.2FWrite
function FileReadLine(const FileName: WideString; LineNum: Integer): String;    Read a line from a file FileName specified by a line index LineNum.
function FileReadTextLines(const FileName: WideString): TWideStringArray;    Read lines of text from a file, performing automatic text encoding handling. Added in v6.7.0.1 Beta.


Try this script instead (not tested)

var 
I: Integer;
UnicodeLines: TWideStringArray;
Initialized: Boolean;

begin
  if not Initialized then 
  begin
    Initialized := True;
    UnicodeLines := FileReadTextLines('C:\Temp\ReNamerNames.txt');
  end;

  FileName := UnicodeLines[I];
  I := I + 1;

end.

http://www.den4b.com/wiki/ReNamer:Rules:PascalScript



HTH? smile



Script modified as explaint in posts below

Last edited by Stefan (2021-06-27 10:30)


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#7 2021-06-26 12:42

Lauraq
Member
Registered: 2016-10-02
Posts: 86

Re: Renamer with names stored in a Text file

Hi smile
Thanks, the script seems to work but there are 2 problems. The first is that when I add the files, a window pops up that says:
Preview process is terminated due to a critical error Line 14 out of range.

The second problem is that the program I use to generate the list doesn't write the extensions in the txt. So if possible your script should not modify the existing extension.

Thank you

Offline

#8 2021-06-26 14:41

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Renamer with names stored in a Text file

Lauraq wrote:

Hi smile
Thanks, the script seems to work but there are 2 problems. The first is that when I add the files, a window pops up that says:
Preview process is terminated due to a critical error Line 14 out of range.

Be sure to have (at least) as many lines with text in your TXT file as you want to rename files.



Lauraq wrote:

The second problem is that the program I use to generate the list doesn't write the extensions in the txt. So if possible your script should not modify the existing extension.

Change
FileName := UnicodeLines[I];
to
FileName := UnicodeLines[I] + WideExtractFileExt(FileName);




 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#9 2021-06-26 15:45

Lauraq
Member
Registered: 2016-10-02
Posts: 86

Re: Renamer with names stored in a Text file

You are right but it is very strange. In the folder I have 13 flacs, the generated txt contains 13 titles BUT your script does not process the first title and starts from the second. For this there is the error.
I did a test with another folder but the problem is the same, the first title is ignored by your script. Very very strange sad

Offline

#10 2021-06-26 17:24

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Renamer with names stored in a Text file

You are right, we have to start counting by 0.


Try changing

  end;
  I := I + 1;
  FileName := UnicodeLines[I];
end.


to

  end;
  FileName := UnicodeLines[I];
  I := I + 1;
end.





 


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

Board footer

Powered by FluxBB