PLAY MACRO Command

Executes a keyboard macro.

PLAY MACRO MacroName [TIME nDelay]

Parameters

  • MacroName
    Specifies the name of the keyboard macro to play.
  • TIME nDelay
    Specifies the time interval between the delivery of each keystroke in a keyboard macro. The delay time must be between 0 and 10 seconds. nDelay can evaluate to a number with a decimal fraction. For example, if you specify nDelay equal to 1.5, keystrokes from the macro will be played with a one-and-a-half-second delay between each keystroke.

Remarks

You can save a series of keystrokes as a keyboard macro by choosing Macros from the Tools menu. PLAY MACRO plays this series of keystrokes. Playing keyboard macros within programs lets you create self-running demo programs.

If you issue PLAY MACRO from the Command window, it executes immediately. If PLAY MACRO is issued in a program, execution is delayed until the program executes a command that allows keyboard input. Examples of commands that wait for input are @ ... GET, BROWSE, CHANGE, and EDIT.

If a series of PLAY MACRO commands is pending in a program, Visual FoxPro doesn't execute the commands in the order in which they are issued. Macros are played in reverse order — the first PLAY MACRO executes last, the last PLAY MACRO executes first — in their bottom-to-top order within the program.

See Also

CLEAR Commands | ON KEY LABEL Command | RESTORE MACROS Command | SAVE MACROS Command