ReNamer:Pascal Script:Break script execution

From den4b Wiki
Revision as of 11:58, 13 August 2009 by Krtek (talk | contribs)
Jump to navigation Jump to search

Using the exit command breaks the current pass of the script. However it doesn’t stop the script from being executed for the next file in the files table and so on. We encounteer here similar problem as with initialization of variables. Solution is also similar. We will use a boolean to keep track if the main code of the script should be executed or not.

TimeToExit : boolean;

  if not TimeToExit then
    //that’s the block for the main script code
    if DialogYesNo('Would you like to exit script?') then TimeToExit := true;

So the script is still executed for every file, but it’s main code is executed only until TimeToExit becomes true. After that script keeps starting just to see that it has nothing to do.