#1 2017-05-11 04:08

m4dcow
Member
Registered: 2017-05-11
Posts: 4

Too many characters in replace text field causes the field to go blank

Every now and then I have to rename a bunch of files using an ever increasing library of acronyms (lcd=liquid crystal display, led=light emitting diode etc...). I store these in an excel file that I can output into the replace format (*|* in between). When I have many acronyms to add I generate from the excel file, but if I only have a few it is quicker to just type them directly into the excel file and also the replace text fields.

The issue is that when the fields get to a certain length they just go blank anything over 5776 characters, now I know this is a ridiculous amount to put in a text field and likely not what the option was designed for but it is a bug/limitation none the less. The renaming operation works fine with blank fields, and my workaround is just to select all within the field, copy to a text editor, add my text and then replace in said text box.

Is this something that can be fixed? and/or have you considered adding a feature like this sort of library replace option by reading in a csv file or something similar?

Sorry if this has been addressed before, I did a few searches and didn't come across anything relating to this.

Offline

#2 2017-05-11 08:00

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

Re: Too many characters in replace text field causes the field to go blank

Hi and welcome.

Maybe you want to use instead a PascalScript rule?
http://www.den4b.com/wiki/ReNamer:Rules:PascalScript


//Multiple replacements (search&replace) from a dictionary list

var
  TempName,BaseName,ExtePart: WideString;

begin
//BaseName := WideExtractBaseName(FileName);
//ExtePart := WideExtractFileExt(FileName);
//TempName := BaseName;
  TempName := FileName;

  
  // -------------------------------------- Replacements
  //ReplaceRegEx(const Input, Find, Replace: WideString;const CaseSensitive, UseSubstitution ($0,$2,$3,...): Boolean): WideString;
  TempName := ReplaceRegEx(TempName, 'FindThis', 'ReplaceWith', False, False);

  //WideReplaceStr(const S, OldPattern, NewPattern: WideString): WideString; //(Case Sensitive)

  //WideReplaceText(const S, OldPattern, NewPattern: WideString): WideString;//(Case Non-Sensitive)
  TempName := WideReplaceStr(TempName, 'FindOldPattern', 'ReplaceNewPattern');
  TempName := WideReplaceText(TempName, 'lcd', 'liquid crystal display');
  TempName := WideReplaceText(TempName, 'led', 'light emitting diode');
//TempName :=  ..... ;
//TempName :=  ..... ;
//TempName :=  ..... ;
//TempName :=  ..... ;

// ---------------------------------------- //


  FileName := TempName;
//FileName := TempName + ExtePart;
end.
 


Also we could read the pairs from a external text file with lines like "OldPattern:NewPattern".
But I have no time right now.... maybe later.



 

 


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

#3 2017-05-11 10:19

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

Re: Too many characters in replace text field causes the field to go blank

m4dcow wrote:

The issue is that when the fields get to a certain length they just go blank anything over 5776 characters, now I know this is a ridiculous amount to put in a text field and likely not what the option was designed for but it is a bug/limitation none the less. The renaming operation works fine with blank fields, and my workaround is just to select all within the field, copy to a text editor, add my text and then replace in said text box.

This appears to be a bug in visual component library. It only affects the visual display of text, while text processing is unaffected, which you can see from the operation or the rule and upon inspection of the preset file.

It will be fixed in due course.

In the meantime, you can either continue to use it as is, or switch to Translit (if you don't need additional options of the Replace rule) or PascalScript rule.

As Stefan has suggested, you can have a script that automatically loads your replacements from a CSV file, for example.

Offline

#4 2017-05-11 16:58

m4dcow
Member
Registered: 2017-05-11
Posts: 4

Re: Too many characters in replace text field causes the field to go blank

Thanks for the suggestions guys, Pascalscript is a bit over my head at this point but I'll probably play around with it since it seems to be able to do many other useful operations. The translit rule is cool too, simpler interface than what I have to do in the replace rule. I'll probably stick to what I know for now and mess around with pascalscript to see if i can get it working that way.

Offline

#5 2017-05-11 17:03

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

Re: Too many characters in replace text field causes the field to go blank

If you provide a small sample of your acronyms (posted as plain text here) just to demonstrate the pattern, then we can help you out with a basic script.

Offline

#6 2017-05-12 14:19

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

Re: Too many characters in replace text field causes the field to go blank

Conversation about a script is continued in a separate topic: Text replacement using a dictionary file.

Offline

#7 2017-05-12 15:23

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

Re: Too many characters in replace text field causes the field to go blank

den4b wrote:

This appears to be a bug in visual component library. It only affects the visual display of text, while text processing is unaffected, which you can see from the operation or the rule and upon inspection of the preset file.

This turned out to be a problem in Windows API, where all functions which are responsible for rending text suffer from this problem, including DrawText, TextOut, ExtTextOut. The problem appears to be bound by the total width of the drawn text (not just the small visible portion), where beyond some point it breaks.

There is no feasible workaround. We can only hope that Microsoft will eventually address this problem, perhaps in Windows 2030 (sarcasm).

Offline

Board footer

Powered by FluxBB