App interaction
The following functions are used to interact with the front end of Magnetron.
- abort
- stops the script immediately and shows a dialog
- echo
- For development and debug purposes. A string that will be saved in the console log. Note: the displayed output in the dev log is capped at 4000 characters per message. The log file will contain the complete output.
- isCanceled
- Checks if the user has pressed cancel in the app. A recipe should check this value within long multistep processes
- quit
- Stops the script and exits the host app
- setMainMessage
- sets the message displayed in the interface to inform the user about any progress.
- setProgress
- Sets the progress meter value in the interface.
examples
function TestProgress()
{
setMainMessage("testing progress");
for (i = 0; i <= 100; i += 10)
{
sleepMs(200); // 200 ms delay
setProgress(i);
if(isCanceled())
abort("user aborted");
}
quit("closed ok"); // closes the whole app
}