Next: , Previous: lower, Up: Commands


3.13 pause

The pause command displays any text associated with the command and then waits a specified amount of time or until the carriage return is pressed. pause is especially useful in conjunction with `load` files.

Syntax:

           pause <time> {"<string>"}
           pause mouse {<endcondition>}{, <endcondition>} {"<string>"}
     

<time> may be any constant or expression. Choosing -1 will wait until a carriage return is hit, zero (0) won't pause at all, and a positive number will wait the specified number of seconds. The time is rounded to an integer number of seconds if subsecond time resolution is not supported by the given platform. `pause 0` is synonymous with print.

If the current terminal supports `mousing`, then `pause mouse` will terminate on either a mouse click or on ctrl-C. For all other terminals, or if mousing is not active, `pause mouse` is equivalent to `pause -1`.

If one or more end conditions are given after `pause mouse`, then any one of the conditions will terminate the pause. The possible end conditions are `keypress`, `button1`, `button2`, `button3`, `close`, and `any`. If the pause terminates on a keypress, then the ascii value of the key pressed is returned in MOUSE_KEY. The character itself is returned as a one character string in MOUSE_CHAR. Hotkeys (bind command) are disabled if keypress is one of the end conditions. Zooming is disabled if button3 is one of the end conditions.

In all cases the coordinates of the mouse are returned in variables MOUSE_X, MOUSE_Y, MOUSE_X2, MOUSE_Y2. See variables.

Note: Since pause communicates with the operating system rather than the graphics, it may behave differently with different device drivers (depending upon how text and graphics are mixed).

Examples:

           pause -1    # Wait until a carriage return is hit
           pause 3     # Wait three seconds
           pause -1  "Hit return to continue"
           pause 10  "Isn't this pretty?  It's a cubic spline."
           pause mouse "Click any mouse button on selected data point"
           pause mouse keypress "Type a letter from A-F in the active window"
           pause mouse button1,keypress
           pause mouse any "Any key or button will terminate"
     

The variant "pause mouse key" will resume after any keypress in the active plot window. If you want to wait for a particular key to be pressed, you can use a reread loop such as:

           print "I will resume after you hit the Tab key in the plot window"
           load "wait_for_tab"
     

File "wait_for_tab" contains the lines

           pause mouse key
           if (MOUSE_KEY != 9) reread