Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
This especially handy during development, when you may discover that you have (for example) neglected to change a WHILE loop index and it is now running out of control: Just click the Cancel button to exit.
The Cancel button can also be activated via Remote Control.
The macro Cancel= command (value optional, ignored) is one way to exit a macro that encounters conditions such that it can't (or shouldn't) proceed, like a value that is out of range. You would normally include this as part of an IF test, along with an explanatory message:
IF.X=>1M Msg="X value out of range!" Cancel= ENDIF.
The Msg will be displayed along with an error message showing the name of the macro. When you click OK in the error message, both it and the Msg will be removed.
In this application the Cancel command could be avoided by use of IF...ELSE commands, such that if the value is in range the ELSE branch runs. The problem with that approach is that if you need more than one or two such tests in your macro it gets rather messy, and can require a lot of indented IF levels so that all tests can directly reach the end of the macro.
Note that there are better approaches to the above issue, such as using LoopBreak=0 to break out of a subroutine or LoopBreak=-1 to abort completely. The latter option behaves similarly to Cancel=, but there will be no error message other than what you provide. You can use ObWaitMsg to provide a message that requires user confirmation.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 35 Years of Innovative Instrumentation
© Copyright 2007 - 2021 by Interstellar Research
All rights reserved