#1 2024-04-22 16:37

jer24
Member
Registered: 2024-04-22
Posts: 3

Renamer pascal script Asking for 2 inputs for renaming video files

I'm new to pascal, not coding.

I wish to be asked the season and starting episode number. then use this to create "Mork and Mindy_S01E03"  for example and each sequential file based on file date is incremented ("Mork and Mindy_S01E04","Mork and Mindy_S01E05"

Looks pretty straight forward, however, the following is not working.
What am I doing wrong?

var
	Initialized : Boolean;
	Season : String;
	EStart : String;
	E : Integer;

procedure Initialize;
begin
  	Initialized := True;
  	InputBox('Season','Enter Season',Season);
  	InputBox('Episode Start','Enter Starting Episode',EStart);
  	E := StrToInt(EStart);
end;

begin
	if not Initialized then Initialize;
	Filename := 'Mork and Mindy_S'+ Season + 'E' + IntToStr(E) + '.mp4'
	E := E +1;
  end.

Offline

#2 2024-04-22 17:07

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

Re: Renamer pascal script Asking for 2 inputs for renaming video files

The signature of the InputBox function:

function InputBox(const ACaption, APrompt, ADefault: String): String;

The 3rd argument only provides the default value. You get the actual user input in the return. See the function reference.

So you should have something like this:

Season := InputBox('Season','Enter Season','1');
EStart := InputBox('Episode Start','Enter Starting Episode','1');

Offline

#3 2024-04-22 20:16

jer24
Member
Registered: 2024-04-22
Posts: 3

Re: Renamer pascal script Asking for 2 inputs for renaming video files

Excellent Thanks!

Offline

Board footer

Powered by FluxBB