execute-kbd-macro

execute-kbd-macro is a built-in function in `C source code'.

(execute-kbd-macro MACRO &optional COUNT LOOPFUNC)

Execute MACRO as string of editor command characters.
MACRO can also be a vector of keyboard events. If MACRO is a symbol,
its function definition is used.
COUNT is a repeat count, or nil for once, or 0 for infinite loop.

Optional third arg LOOPFUNC may be a function that is called prior to
each iteration of the macro. Iteration stops if LOOPFUNC returns nil.