#1 2016-08-05 03:07

tylerheatherly
Member
Registered: 2016-08-05
Posts: 2

Using UserInput's "Load from Text File" in a Preset

I'm trying to use the "Load from Text File" feature of the UserInput function inside of a preset but I cant seem to figure out the proper syntax.  I have no problem in the GUI selecting a .txt file that contains a list of filenames, but I can seem to get the preset to load the same text file.

[Rule0]
ID=UserInput
Config=INPUT:"C:\replace.txt";ACTION:0;SKIPEXTENSION:0
Marked=1

I've also tried:

[Rule0]
ID=UserInput
FileName=C:\replace.txt;ACTION:0;SKIPEXTENSION:0
Marked=1

Thank you for your help,
Tyler

Offline

#2 2016-08-05 12:35

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

Re: Using UserInput's "Load from Text File" in a Preset

The option to load new names from a text file just loads the content and forgets the reference to a file. You can't force it by specifying a filepath, because it will be just interpreted literally as a new name.

If you require to load the file with new names dynamically before renaming each time, then you can use this PascalScript rule:

const
  FileWithNewNames = 'C:\names.txt';
var
  Index: Integer;
  NewNames: TAnsiStringArray;
begin
  if Length(NewNames) = 0 then
  begin
    NewNames := FileReadLines(FileWithNewNames);
  end;
  FileName := NewNames[Index];
  Index := Index + 1;
end.

Note that it will replace the entire filename including extension, and it interprets the content of the file using the current system locale.

Offline

#3 2016-08-07 09:19

tylerheatherly
Member
Registered: 2016-08-05
Posts: 2

Re: Using UserInput's "Load from Text File" in a Preset

Thank you so much for your help!  The PascalScript worked perfectly for my project.

Offline

Board footer

Powered by FluxBB