#1 2013-08-09 22:58

medwatt
Member
Registered: 2013-08-09
Posts: 4

Shift Numbering

Hello,
First of all, thanks for the program. I am familiar with Pascal. I have files with names like ( 001,002,003 . . . ). I was trying to rename them such that they big are like ( 014, 015,016). That is, I want to shift the numbering by some integer value. I tried using the val function which is available in lazarus but your program could not recognise it. So I tried using this :

var
  I: Integer;
const
  Start_Index = 14;

begin
  I := StrToInt(FileName);
  I := I + 14;
  FileName := IntToStr(I);
end.

What I want is simple enough. Somehow it didn't work. I don't know why. Please help

Thanks.

Offline

#2 2013-08-10 08:57

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

Re: Shift Numbering

1.) 'FileName' is file name, incl. the extension.
Use 'ShowMessage(FileName);' as a MsgBox to see that.

Lookup 'WideExtractBaseName(FileName)' in the wiki > http://www.den4b.com/wiki/ReNamer:Pasca … :Functions.
Hint: after that, you have to use 'WideExtractFileExt(FileName)' too.

2.) 'Integer' will drop the leading zeros.
So you have to use a own function to pad the output with zeros to get three digits again.


If you want to have the fun (as it seams) you will find all code in the forum.


If you want more help or working code,... just ask.


ine
  onfr: Vagrtre;
  ahzo: Fgevat;

ortva
  onfr := FgeGbVag(JvqrRkgenpgOnfrAnzr(SvyrAnzr));
   //fubjzrffntr(svyranzr);
  ahzo := VagGbFge(onfr + 14);
  juvyr yratgu(ahzo) < 3 qb
     ahzo:= '0'+ahzo;
     
  SvyrAnzr := ahzo + JvqrRkgenpgSvyrRkg(SvyrAnzr);
raq.

Last edited by Stefan (2013-08-10 09:09)


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 2013-08-11 13:53

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

Re: Shift Numbering

Ha, what is that below? Caesar cipher? big_smile

Stefan wrote:

ine
  onfr: Vagrtre;
  ahzo: Fgevat;

ortva
  onfr := FgeGbVag(JvqrRkgenpgOnfrAnzr(SvyrAnzr));
   //fubjzrffntr(svyranzr);
  ahzo := VagGbFge(onfr + 14);
  juvyr yratgu(ahzo) < 3 qb
     ahzo:= '0'+ahzo;
     
  SvyrAnzr := ahzo + JvqrRkgenpgSvyrRkg(SvyrAnzr);
raq.

Offline

Board footer

Powered by FluxBB