At the beginning of my notebook I am performing some checks. If these checks fail I want to prevent further evaluation of the notebook. I have tried Abort[] but that doesn't prevent evaluation continuing.
Or, could I have a "launcher" notebook which carries out the checks and only "launches" the main notebook if the checks pass?
Hi Paul,
Encapsulate all of the checks in a function. If a check fails then Abort[]. E.g
Abort[]
checkPreconditions[] := Module[{x = 1}, If[True, Abort[]]; x = 2]
Or use CompoundExpression
CompoundExpression
( x = 1; If[True, Abort[]]; x = 2; Print@x )
Hi Rohit
The most promising solution I have found so far is to create a "Launcher.nb" notebook where I carry out the "checkPreConditions" and only then use NotebookEvaluate("Launchee.nb") if the checks pass.
This seems to be working well and obviates the need for any checking in Launchee.nb.