A yes-no message box

A simple yes-no message box can be created by specifying a "Yes" and "No" button:

 

var userResponse = MessageBox.information("Start the batch processing?", MessageBox.Yes, MessageBox.No);

 

The response of the user is captured in the variable "userResponse". Only when the user clicked the "Yes" button, the batch processing should start. This can be achieved via the following line:

 

if (userResponse == MessageBox.Yes) {

 

}

 

The statements to do the batch processing can be specified within the if { ... }  block.

The following function:

 

function Yes_no_message_box() {

 

var userResponse = MessageBox.information("Start the batch processing?", MessageBox.Yes, MessageBox.No);

if (userResponse == MessageBox.Yes) {

BrainVoyagerQX.PrintToLog("The answer was YES. Batch processing will start...");

// put the batch processing statements here

 

} else if (userResponse == MessageBox.No) {

BrainVoyagerQX.PrintToLog("The answer was NO. Batch processing cancelled.");

}

}

 

will result in this yes-no message box:

 

 

 

The user response is written to the BrainVoyager Log tab via the command BrainVoyagerQX.PrintToLog():