ReNamer:Pascal Script:Break script execution
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.
var TimeToExit : boolean; begin if not TimeToExit then begin //that’s the block for the main script code if DialogYesNo('Would you like to exit script?') then TimeToExit := true; exit; end; end.
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.