3.3.2.3 Break

Provides a visual interface to view the progress of a script that includes a loop.


Syntax:

break [option] argument

Options:

no option [argument]; Unconditional exit from any loop

Syntax: break no option

Unconditional exit from any loop. If argument = 1, also exit from the current script.

-b caption; Open the progress status dialog box with Cancle button

Syntax: break -b caption

Open the progress status dialog box with the caption caption. This dialog box includes a Cancel button. Click Cancel to break from the entire script.

-be caption; Open the progress status dialog box with the End button

Syntax: break -be caption

Open the progress status dialog box with the caption caption. This dialog box includes an End button. Click on the End button to break from the loop and continue the script after the loop.

-bm caption; Open the progress status dialog box with the caption caption

Syntax: break -bm caption

Open the progress status dialog box with the caption caption. All other controls in the dialog box are hidden. Use this option to display the caption only.

-e; Close the progress status dialog box

Syntax: break -e

Close the progress status dialog box.The value of variable is converted to a percent using the min and max range set with the -r option. Before using this option, you must use either the -b or -be option to open the progress status dialog box. You must also use the -r option before using this option. This command option updates the progress status dialog box with the value of variable converted to a percent using the min and max range set with the -r option. For example, if min = 0 and max = 100 and the initial value of variable is 10, the percent completion display will start at 10%. n general, variable is initialized and incremented in the loop. For an example using the -p and -r options, see the Examples, below.

-p variable; Updates the progress status dialog box with the value of variable

Syntax: break -p

This command option updates the progress status dialog box with the value of variable.

-r min nax;Set the range of values used in the progress status dialog box

Syntax: break -r min nax

Set the range of values used in the percentage completion display in the progress status dialog box. Before using this option, you must use either the -b or -be option to open the progress status dialog box. Use this option before the -p option.

Examples:

In the following script, if a zero value is encountered in the Book1_A dataset, the script displays an error message and breaks out of both the loop and the script. If a negative value is encountered, the script breaks out of the loop. In both instances, the reciprocal summ of all values is stored in myvar.

myvar = 0;
loop (ii, 1, 10) 
{
    if (Book1_A[ii] == 0)
    {
        type -b "error"; 
        break 1;  
    }
    if (Book1_A[ii] < 0) break;
    myvar += (1 / Book1_A[ii]);
}

The next script utilizes the progress status dialog box.

break -b This is the caption for the dialog box;  
break -r 50 100;  // the range of values will be 50 - 100 
for (ii = 50; ii <= 100; ii++)  
{
      break -p ii;   // the current value is ii
      // Put your code here
      sec -p .1;   // Delay to simulate executing code
};
break -end;  // done, close the dialog box

See Also:

Continue (command)

If (command), Exit (command), For (command), Loop (command), Repeat (command), Switch (command), Document -e (command)