PDA

Click to See Complete Forum and Search --> : Rename multiple files for Inno Setup .


roger27br
Sep 18th, 2009, 04:38 PM
Hello Gentlemen,

I need a help, I'm a little time fiddling with the Inno Setup, and I'm creating a project and this project I want to rename multiple files and I'm not getting, I can only rename the first file the rest is not possible, the total file I need to rename is around 17. Then I would like to uninstall the application when the file back to its original name, follows the code I'm using.


procedure CurStepChanged(CurStep: TSetupStep);
var
OldName: String;
NewName: String;
begin
if CurStep = ssInstall then begin
OldName := ExpandConstant('{sd}\My Project\auxsetup.exe')
NewName := ExpandConstant('{sd}\My Project\auxsetup.old');
OldName := ExpandConstant('{sd}\My Project\setup.exe')
NewName := ExpandConstant('{sd}\My Project\setup.old')
if FileExists(OldName) then RenameFile(OldName, NewName);
end;
end;




Procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
OldName: String;
NewName: String;
begin
if CurUninstallStep = usPostUninstall then begin

OldName := ExpandConstant('{sd}\My Project\auxsetup.old');
NewName := ExpandConstant('{sd}\My Project\auxsetup.exe');
OldName := ExpandConstant('{sd}\My Project\setup.old');
NewName := ExpandConstant('{sd}\My Project\setup.exe');

if FileExists (OldName) then RenameFile(OldName,NewName);
end;
end;


Regards