#11 2006-07-19 12:25

azazell0_v2
Member
Registered: 2006-07-19
Posts: 2

Re: Renamer: PascalScript predefined variable request

Denis Kozlov wrote:

Not "direct" renaming will spell disaster some day. Because user will not be aware of that, whatever he sees - thats what he expects to get renamed, and if ReNamer says there are validation violations - then user should simply reconsider the rules that he/she uses. I'm strongly against temporary steps, since there are really a lot of things that can go wrong, and if they will go wrong - user will lost, and files may be lost as well.

You've got a point there, of course. Yes I know one can always find a workaround, I just thought it'd be nice if ReNamer could produce every legal output without hassle. You know, the "just-works" thing smile

There's a third possibility as well: when such errors are present, ask the user first if he wants to do an automatic two-step rename.

Offline

#12 2006-07-19 13:10

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

Re: Renamer: PascalScript predefined variable request

Hmm... I like the "_" underscore solution much more then the user prompt one big_smile

By the way, I've set the password for azazell0 to be the same as for azazell0_v2, so you can use your old nick name. I don't know what the password was/is, since this forum stores only a hash of it...

Offline

#13 2006-07-20 21:42

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

Re: Renamer: PascalScript predefined variable request

!!! I FOUND IT !!!! big_smile

I found a way to create an array of files that are in ReNamer without any modifications and without scanning directories! That piece of code will write a list of files from ReNamer, one per line, in the 'c:\files.txt' file. Just preview using that script, and then create another script that will be reading all previously written files from 'c:\files.txt' using FileReadLine function smile


var
  Files: TStringsArray;

function Len: Integer;
begin
  Result := WideArrayLength(Files);
end;

procedure Add(const S: WideString);
begin
  WideArraySetLength(Files, Len+1);
  Files[Len-1] := S;
end;

procedure Save(const Path: WideString);
var
  Contents: string;
  I: Integer;
begin
  Contents := '';
  for I:=0 to Len-1 do
    Contents := Contents + UTF8Encode(Files[i]) + #13#10;
  FileWriteContent(Path, Contents);
end;

begin
  Add(FileName); // or use FilePath variable to store original path!
  Save('c:\files.txt');
end.

Offline

Board footer

Powered by FluxBB