ReNamer:Scripts:Initialize
Revision as of 13:04, 7 February 2010 by Den4b (talk | contribs) (Created page with 'Pascal Script code gets executed for every file name, but sometimes we need to run some sort of initialization procedure and run it only once. In order …')
Pascal Script code gets executed for every file name, but sometimes we need to run some sort of initialization procedure and run it only once. In order to achieve this we need to remember one simple fact: Boolean variables are initialized to "False" before the code is ran for the first time, so we can use this state for our own initialization procedure.
Code
var
Initialized: Boolean;
procedure Initialize;
begin
Initialized := True;
// Initialization code here...
end;
begin
if not Initialized then Initialize;
// Main code here...
end.